GitHub

Library requires PHP 7.2.0 or above.

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();

Read the original on github.com ↗