Download the PHP package maegnes/slim-caching-manager without Composer
On this page you can find all versions of the php package maegnes/slim-caching-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maegnes/slim-caching-manager
More information about maegnes/slim-caching-manager
Files in maegnes/slim-caching-manager
Package slim-caching-manager
Short Description Caching Manager for the SLIM Framework
License BSD-3-Clause
Homepage https://github.com/maegnes/SlimCachingManager
Informations about the package slim-caching-manager
SlimCachingManager
Works under https://github.com/codeguy/Slim ~2.3 (>= 2.3 AND < 3.0)
The SlimCachingManager helps you to simplify caching and the delivery of the cached data of the Slim Framework resources. It stores the caching data for each resource (etag, expiry, lastmodified etc.) in ResourceHandlers which can be written on your own by implementing the IResourceHandler.
It's helpful for resources which doesn't have any physical changes to detect that the resource has been changed (e.g. database query results). It's possible to define resources (wildcard notation possible) which you'd like to have cached. SlimCachingManager will automatically check if the resource should or is being cached at the moment. The rest is quite simple.
You want to use SlimCachingManager? Just follow the steps at the bottom of the page. All your headers (Etag, Lastmodified, expiry) will be set by SlimCachingManager.
If you have any questions or suggestions to improve SlimCachingManager feel free to contact me. If you want to contribute just add a new branch and send me a pull request.
Best regards Magnus
Installation via Composer
Add the following dependency to your composer.json file.
{
"require": {
"maegnes/slim-caching-manager": "dev-master"
}
}
Usage
- Create instance of Slim
- Add resources to the ResourceMapper which should be cached (Wildcards allowed!)
- Add a before.dispatch hook or middleware (in the example it's done by hook)
- Create instance of SlimCachingManager\ResourceMapper\Etag() or SlimCachingManager\ResourceMapper\Lastmodified() (depends on needed cache method)
- Inject your the ResourceHandler into ResourceMapper
- Inject the Slim application into ResourceMapper
- Call method setHeaders()
Example
If you don't want to use the "Textfile" Resourcehandler just write your own by implementing SlimCachingManager\ResourceHandler\IResourceHandler!
Have fun!