use Cache\Adapter\Filesystem\FilesystemCachePool; $cache = new FilesystemCachePool('/path/to/cache/directory'); $cache->set('my_key', 'my_value'); $value = $cache->get('my_key');
use Cache\Adapter\Memcached\MemcachedCachePool; $memcached = new \Memcached(); $memcached->addServer('localhost', 11211); $cache = new MemcachedCachePool($memcached); $cache->set('my_key', 'my_value'); $value = $cache->get('my_key');
use Cache\Adapter\Redis\RedisCachePool; $redis = new \Redis(); $redis->connect('localhost', 6379); $cache = new RedisCachePool($redis); $cache->set('my_key', 'my_value'); $value = $cache->get('my_key');PHP Cache Factory is part of the Cache namespace in the PHP League, a collection of packages for working with caching, encryption, validation, parsing, and more. The package library can be found here: https://github.com/thephpleague.