lSet 命令/方法/函数

Set the list at index with the new value.

根据索引值设置新的VAULE


Parameters

key index value


Return value

BOOL TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key is not a list.

如果设置成功返回TURE,如果KEY所指向的不是LIST,或者索引值超出LIST本身的长度范围,则返回flase。


Iset函数更像是UPDATE或者EDIT的概念,而不是INSERT或者ADD的概念,顾只能在LIST本身的长度范围内,而不能超出。


Example

$redis->rPush('key1', 'A');

$redis->rPush('key1', 'B');

$redis->rPush('key1', 'C'); /* key1 => [ 'A', 'B', 'C' ] */

$redis->lGet('key1', 0); /* 'A' */

$redis->lSet('key1', 0, 'X');

$redis->lGet('key1', 0); /* 'X' */