Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seregazhuk/php-react-cache-memcached
Memcached cache implementation for react/cache
https://github.com/seregazhuk/php-react-cache-memcached
memcached memcached-clients php reactphp
Last synced: 2 months ago
JSON representation
Memcached cache implementation for react/cache
- Host: GitHub
- URL: https://github.com/seregazhuk/php-react-cache-memcached
- Owner: seregazhuk
- Created: 2017-11-17T15:20:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-15T15:20:58.000Z (over 6 years ago)
- Last Synced: 2024-08-08T22:52:26.930Z (5 months ago)
- Topics: memcached, memcached-clients, php, reactphp
- Language: PHP
- Homepage:
- Size: 12.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Memcached cache implementation for react/cache
[![Build Status](https://travis-ci.org/seregazhuk/php-react-cache-memcached.svg?branch=master)](https://travis-ci.org/seregazhuk/php-react-cache-memcached)
Implementation of [react/cache interface](https://github.com/reactphp/cache) that uses Memcached as a storage.
**Table of Contents**
- [Installation](#installation)
- [Quick Start](#quick-start)## Installation
Library requires PHP 7.2.0 or above.
The recommended way to install this library is via [Composer](https://getcomposer.org).
[New to Composer?](https://getcomposer.org/doc/00-intro.md)See also the [CHANGELOG](CHANGELOG.md) 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:
```php
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();
```