Michael Nitschinger has put together a guide to caching responses in the Lithium framework - a simple update that means your application dosen't even need to reach the controllers to do its job.
I've hacked together a small example on how to easily cache full responses in Lithium. If you need to cache full Response objects in Lithium (which means that your controllers don't even get called when there's a cache hit), you can place this in your app/config/bootstrap/cache.php file (note that this is certainly not "production ready", but it should give you a starting point).
The code adds a new filter to run on execute that takes the current object (the Response object hit the first time) and use the Cache functionality to push it into storage. Their cache key is based on the URL, so each requests is cached individually. You can find out more about filters and the framework at Lithify.me.
没有评论:
发表评论