Description
Return the specified element of the list stored at the specified key. 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... Return FALSE in case of a bad index or a key that doesn't point to a list.
根据索引值返回指定KEY LIST中的元素。0为第一个元素,1为第二个元素。-1为倒数第一个元素,-2为倒数第二个元素。如果指定了一个不存在的索引值,则返回FLASE。
Parameters
key index
Return value
String the element at this index
Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key.
Example
$redis->rPush('key1', 'A');
$redis->rPush('key1', 'B');
$redis->rPush('key1', 'C'); /* key1 => [ 'A', 'B', 'C' ] */
$redis->lGet('key1', 0); /* 'A' */
$redis->lGet('key1', -1); /* 'C' */
$redis->lGet('key1', 10); /* `FALSE` */