fredbradley / cacher
A Multiframework compatible Cache interface.
Requires
- php: ^8.0
Requires (Dev)
- phpstan/phpstan: ^0.12.83
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
Suggests
- fredbradley/easytime: Easy human readable representation of seconds and minutes
README
In my day job, I work regularly with both Laravel and WordPress. I also make packages that are needed to be compatible with both. It becomes a right pain, when it comes to caching, to write out if statements for each framework. So I created this small script which does that for me.
Installation
You can install the package via composer:
composer require fredbradley/cacher
Usage
use FredBradley\Cacher; Cacher::remember('cache_key_name', 300, function() { // Your logic $value = "value"; return $value; }); /* * Will set the value of 'cache_key_name' to the return value of the Closure callback and * save in the cache for 5 minutes (300 seconds) */
There's only a small handful of methods in the one class. It's really basic, but amazingly wonderful!
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email code@fredbradley.co.uk instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.