I have a advance cache system I use, and I store the results of a packet encoding inside a .dat file.
Example:
public function saveChunk($pk, $id){
file_put_contents("cache/" . $id, serialize($pk));
}
This creates a .dat file which has the chunk encoding.
Anyways, this creates about 7000 .dat files, and it is very messy on my linux server.
Whats a good way I can have one file and assign a ID to each packet, and later retrieve the packet with the id? (It also needs to be speed efficient)