https://github.com/fredbradley/cacher
A multi-framework compatible caching interface
https://github.com/fredbradley/cacher
cache caching laravel wordpress
Last synced: about 1 year ago
JSON representation
A multi-framework compatible caching interface
- Host: GitHub
- URL: https://github.com/fredbradley/cacher
- Owner: fredbradley
- License: mit
- Created: 2020-07-10T08:45:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-13T16:06:01.000Z (about 4 years ago)
- Last Synced: 2025-05-12T02:16:15.645Z (about 1 year ago)
- Topics: cache, caching, laravel, wordpress
- Language: PHP
- Homepage: https://git.fred.im/cacher
- Size: 38.1 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Multi Framework Cacher Script
[](https://packagist.org/packages/fredbradley/cacher)
[](LICENSE.md)

[](https://packagist.org/packages/fredbradley/cacher)
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:
```bash
composer require fredbradley/cacher
```
## Usage
``` php
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
``` bash
composer test
```
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email code@fredbradley.co.uk instead of using the issue tracker.
## Credits
- [Fred Bradley](https://github.com/fredbradley)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.