代潇瑞博客

sRandMember 命令/方法/函数

Returns a random element from the set value at Key, without removing it.

取得指定SET容器中的一个随机元素,但不会在SET容器中移除它。


Parameters

key


Return value

String value from the set

Bool FALSE if set identified by key is empty or doesn't exist.


Example

$redis->sAdd('key1' , 'member1');

$redis->sAdd('key1' , 'member2');

$redis->sAdd('key1' , 'member3'); /* 'key1' => {'member3', 'member1', 'member2'}*/

$redis->sRandMember('key1'); /* 'member1', 'key1' => {'member3', 'member1', 'member2'} */

$redis->sRandMember('key1'); /* 'member3', 'key1' => {'member3', 'member1', 'member2'} */

【相关命令】

触屏版 | 电脑版

Copyright © 2013 代潇瑞博客手机版

QQ: 446673330

粤ICP备13071969号-1