seregazhuk/react-cache-memcached

ReactPHP Memcached Cache implementation

1.0.2 2018-09-15 15:10 UTC

This package is auto-updated.

Last update: 2024-11-16 04:47:54 UTC


README

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