Skip to content

seregazhuk/php-react-cache-memcached

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memcached cache implementation for react/cache

Build Status

Implementation of react/cache interface that uses Memcached as a storage.

Table of Contents

Installation

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

Quick Start

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