piotrpress / cacher
This library provides a simple file-based caching solution.
v1.1.0
2023-11-22 19:59 UTC
Requires
- php: >=8.0
This package is auto-updated.
Last update: 2024-04-22 20:48:18 UTC
README
This library provides a simple file-based caching solution.
Installation
$ composer require piotrpress/cacher
Usage
require __DIR__ . '/vendor/autoload.php'; use PiotrPress\Cacher; $cache = new Cacher( '.cache' ); $value = $cache->get( 'hi', function ( $arg1, $arg2 ) { return "$arg1 $arg2"; }, 'Hello', 'world!' ); $cache->clear( 'hi' ); // clear cache for "hi" key $cache->clear(); // clear all cache
Note: You can use php://memory
as a file to store cache in memory, for instance, while developing or testing.
Requirements
Supports PHP >= 8.0
version.