sMove 命令/方法/函数

Moves the specified member from the set at srcKey to the set at dstKey.

移动一个指定的MEMBER从源SET到指定的另一个SET中。


Parameters

srcKey dstKey member


Return value

BOOL If the operation is successful, return TRUE. If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey,FALSE is returned.

如果操作成功返回TRUE,如果源SET或者目标SET不存在,或者MEMBER不存在于源SET,那么返回FLASE。


Example

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

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

$redis->sAdd('key1' , 'member13'); /* 'key1' => {'member11', 'member12', 'member13'}*/

$redis->sAdd('key2' , 'member21');

$redis->sAdd('key2' , 'member22'); /* 'key2' => {'member21', 'member22'}*/

$redis->sMove('key1', 'key2', 'member13'); /* 'key1' =>  {'member11', 'member12'} */

                    /* 'key2' =>  {'member21', 'member22', 'member13'} */