php 操作redis随笔

以下

$redis = new Redis();
$redis->connect('127.0.0.1',6379);

//$redis->lPushx('mylist','hw');
$redis->lSet('mylist',0,'hlw');
$mylist = $redis->lRange('mylist',0,20);

$hgetall = $redis->hGetAll('runoobkey');
$etis = $redis->hExists('runoobkey','name');
$hval = $redis->hVals('runoobkey');


//set
$redis->sAdd('myset','helloworld');
$members = $redis->sMembers('myset');


//sorts set

 $redis->zAdd('sset','8','memcache');
$sset = $redis->zRevRangeByScore('sset','+inf' ,'-inf' ,['WITHSCORES'=>'WITHSCORES','limit' => [ 0,2]]);

你可能感兴趣的:(redis)