CacheBundle
CacheBundle copied to clipboard
optimized performance of LifetimeFileCache by having FileCache retain last fetch
Once a cache is warmed up, an application will call CacheInterface::contains() and CacheInterface::fetch() in rapid succession. The LifetimeFileCache would perform a file_get_contents() and unserialize() operation for both of these calls, which for a large object can be expensive.
To remedy this, I've added extra smarts to FileCache so that it retains the very last thing which was fetched, so that if it is re-requested by the application or a derived class, it will return the in-memory copy.