Implementation of react/cache interface that uses Memcached as a storage.
Table of Contents
Library requires PHP 7.2.0 or above.
The recommended way to install this library is via Composer. New to Composer?
See also the CHANGELOG for details about version upgrades.
composer require seregazhuk/react-cache-memcached
React\Cache\CacheInterface
has three simple methods to store, retrieve and remove data:
use React\EventLoop\Factory;
use seregazhuk\React\Cache\Memcached\Memcached;
$loop = Factory::create();
$cache = new Memcached($loop);
// store
$cache->set('key', 12345);
// store for a minute
$cache->set('key', 12345, 60);
// retrieve
$cache->get('key')->then(function($value){
// handle data
});
// ...
// delete
$cache->delete('key');
$loop->run();