Easily store any model queries in cache and refer back to them later.
One of my few 100% completed successes. Still could use unit tests though.
This plugin lets you replace your
$Model->cache() and there by immediately hooks into your existing code. No other major refactoring becomes necessary. Cached data becomes namespaced based on the parameters passed to the find, including the find type used. The plugin even works with custom find methods, acting as merely a wrapper that never touches the database, so supplemented data added to
$results becomes cached too!
The only responsibility left to the developer is deciding the lifespan of the cache. By default, the behavior will actually wipe out all caches namespaced to the model upon additions or deletions to the model. However, since it is more than likely that the cached data contains recursive information, it is possible that this related data may become stale. For this reason it becomes prudent for the developer to be aware of and monitor his cache lifespans and to occasionally manually reset the cache when necessary.
Requires the clear_cache plugin.