|
| 1 | +# Redis cache implementation for react/cache |
| 2 | + |
| 3 | +[](https://travis-ci.org/WyriHaximus/reactphp-cache-redis) |
| 4 | +[](https://packagist.org/packages/WyriHaximus/react-cache-redis) |
| 5 | +[](https://packagist.org/packages/WyriHaximus/react-cache-redis) |
| 6 | +[](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-cache-redis/?branch=master) |
| 7 | +[](https://packagist.org/packages/WyriHaximus/react-cache-redis) |
| 8 | +[](https://travis-ci.org/WyriHaximus/reactphp-cache-redis) |
| 9 | + |
| 10 | +Use redis as a cache, implementing the [react/cache interface](https://github.com/reactphp/cache) |
| 11 | + |
| 12 | +# Installation |
| 13 | + |
| 14 | +To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`. |
| 15 | + |
| 16 | +``` |
| 17 | +composer require wyrihaximus/react-cache-redis |
| 18 | +``` |
| 19 | + |
| 20 | +# Usage |
| 21 | + |
| 22 | +```php |
| 23 | +<?php |
| 24 | + |
| 25 | +use Clue\React\Redis\Client; |
| 26 | +use Clue\React\Redis\Factory as RedisFactory; |
| 27 | +use React\EventLoop\Factory as LoopFactory; |
| 28 | +use WyriHaximus\React\Cache\Redis; |
| 29 | + |
| 30 | +$loop = LoopFactory::create(); |
| 31 | +$factory = new RedisFactory($loop); |
| 32 | + |
| 33 | +$factory->createClient()->then(function (Client $client) { |
| 34 | + $cache = new Redis($client, 'react:cache:your:key:prefix:'); |
| 35 | +}); |
| 36 | +``` |
| 37 | + |
| 38 | +# License |
| 39 | + |
| 40 | +The MIT License (MIT) |
| 41 | + |
| 42 | +Copyright (c) 2016 Cees-Jan Kiewiet |
| 43 | + |
| 44 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 45 | +of this software and associated documentation files (the "Software"), to deal |
| 46 | +in the Software without restriction, including without limitation the rights |
| 47 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 48 | +copies of the Software, and to permit persons to whom the Software is |
| 49 | +furnished to do so, subject to the following conditions: |
| 50 | + |
| 51 | +The above copyright notice and this permission notice shall be included in all |
| 52 | +copies or substantial portions of the Software. |
| 53 | + |
| 54 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 55 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 56 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 57 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 58 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 59 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 60 | +SOFTWARE. |
0 commit comments