代潇瑞博客

sAdd 命令/方法/函数

Adds a value to the set value stored at key. If this value is already in the set, FALSE is returned.

添加一个VALUE到SET容器中,如果这个VALUE已经存在于SET中,那么返回FLASE。


Parameters

key value


Return value

BOOL TRUE if value didn't exist and was added successfully, FALSE if the value is already present.

如果VALUE不存在于SET中,那么ADDED成功,返回TRUE,负责返回FALSE。


Example

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

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

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

【相关命令】

触屏版 | 电脑版

Copyright © 2013 代潇瑞博客手机版

QQ: 446673330

粤ICP备13071969号-1