PHP code example of seregazhuk / react-cache-memcached
1. Go to this page and download the library: Download seregazhuk/react-cache-memcached library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
seregazhuk / react-cache-memcached example snippets
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();