qiushiyong e6dfdcce86 redis安装及配置 | %!s(int64=2) %!d(string=hai) anos | |
---|---|---|
.. | ||
src | %!s(int64=2) %!d(string=hai) anos | |
tests | %!s(int64=2) %!d(string=hai) anos | |
README.md | %!s(int64=2) %!d(string=hai) anos | |
composer.json | %!s(int64=2) %!d(string=hai) anos | |
phpunit.php | %!s(int64=2) %!d(string=hai) anos |
测试前记得修改phpunit.php修改配置
./vendor/bin/co-phpunit tests
http://www.easyswoole.com/Components/Redis/introduction.html
目前,该redis客户端组件,已经支持除去脚本外的所有方法(目前支持了178个方法):
由于redis的命令较多,可能漏掉1,2个命令
<?php
include "../vendor/autoload.php";
go(function (){
$redis = new \EasySwoole\Redis\Redis(new \EasySwoole\Redis\Config\RedisConfig([
'host' => '127.0.0.1',
'port' => '6379',
'auth' => 'easyswoole',
'serialize' => \EasySwoole\Redis\Config\RedisConfig::SERIALIZE_NONE
]));
var_dump($redis->set('a',1));
var_dump($redis->get('a'));
});
<?php
include "../vendor/autoload.php";
go(function () {
$redis = new \EasySwoole\Redis\RedisCluster(new \EasySwoole\Redis\Config\RedisClusterConfig([
['172.16.253.156', 9001],
['172.16.253.156', 9002],
['172.16.253.156', 9003],
['172.16.253.156', 9004],
], [
'auth' => '',
'serialize' => \EasySwoole\Redis\Config\RedisConfig::SERIALIZE_PHP
]));
var_dump($redis->set('a',1));
var_dump($redis->get('a'));
var_dump($redis->clusterKeySlot('a'));
});