shen2 / easy-redis
an async redis wrapper for phpredis
Installs: 387
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 1
Open Issues: 1
pkg:composer/shen2/easy-redis
Requires
- php: >=5.4.0
- ext-redis: *
This package is auto-updated.
Last update: 2025-10-23 21:27:32 UTC
README
an async redis wrapper for phpredis
Features
- Using phpredis extension (nicolasff/phpredis)
- Support asynchronous and synchronous request
- Support for logged, unlogged and counter batches
Installation
PHP 5.4+ is required. phpredis extension is required.
Append dependency into composer.json
...
"require": {
...
"shen2/easy-redis": "dev-master"
}
...
Basic Using
<?php $config = array( 'host' => 'localhost', 'port' => 6379, 'persistent'=> false, 'database' => 0, 'profiler' => true, ); // Create a connection. $redisManager = new EasyRedis\Manager($config); // send request synchronously. $redisManager->send('set', ['a', 'abc']); echo $redisManager->send('get', ['a']) . "\n"; // send request asynchronously $redisManager->sendAsync('set', ['a', 'abc']); $redisManager->sendAsync('set', ['b', '123'])->then(function(){ echo "successed.\n"; });