Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimized performance of LifetimeFileCache by having FileCache retain last fetch #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lordelph
Copy link
Contributor

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.

…is increases the performance of LifetimeFileCache which previously would perform two unserialize operations, one during contains() and then a second during fetch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant