Php – What system to use for a key-value cache on a single server

cachingmemcachedPHP

I'm implementing a PHP script which will need some caching capabilities.

I'm trying to determine which caching strategy to use for user data assuming that the script is running on a single server.
I'm probably looking at about 50k different keys. The data for each key is not very big – in most cases less than 5kb.

I have implemented a key / value file cache where I md5 hash the key to determine the file name for the hashed file. I then store it in a directory tree with 256 files at each level in order to avoid having too many files in one directory.

It appears that with this setup HD performance is becoming a bottleneck. Would I be better of with using memcached?

APC or similar is not an option since the PHP files are ioncube encoded and it appears they don't play well together.

Best Answer

memcached is a really good choice for this since it's optimized for key/value caching. Otherwise, you can create a RAM disk and save your cached files to that "disk" instead