sidebar_key cache-engine tags
A powerful, versatile cache implementation providing both PSR-6 and PSR-16 interfaces with support for multiple storage drivers.
PSR-16 Simple Cache interface - Simple, straightforward caching APIPSR-6 Cache Pool interface - More verbose caching with fine-grained controlMultiple storage backends - Choose from memory, file system, Redis, Memcached and moreAtomic operations - Support for increment, decrement and add operations in compatible enginesGarbage collection - Automatic cleanup of expired itemsPSR-11 container support - Retrieve cache keys via dependency containerLogging capabilities - PSR-3 compatible logging of cache operationscomposer require " byjg/cache-engine" // PSR-16 Simple Cache $ cache = new \ByJG \Cache \Psr16 \FileSystemCacheEngine ();
$ cache ->set ('key ' , 'value ' , 3600 ); // Cache for 1 hour $ value = $ cache ->get ('key ' );
// PSR-6 Cache Pool $ pool = \ByJG \Cache \Factory::createFilePool ();
$ item = $ pool ->getItem ('key ' );
if (!$ item ->isHit ()) {
$ item ->set ('value ' );
$ item ->expiresAfter (3600 );
$ pool ->save ($ item );
}
$ value = $ item ->get ();vendor/bin/phpunit --stderr
Note: The --stderr parameter is required for SessionCacheEngine tests to run properly.
flowchart TD
byjg/cache-engine --> psr/cache
byjg/cache-engine --> psr/log
byjg/cache-engine --> psr/simple-cache
byjg/cache-engine --> psr/container
Loading Open source ByJG