您好,欢迎访问一九零五行业门户网

php-redis中文参考手册_Ping_echo_set_get_setex_psetex_..._PHP教程

ping
description
check the current connection status
检查当前连接实例的状态
parameters
(none)
return value
string: +pong on success. throws a redisexception object on connectivity error, as described above.
如果失败,throws一个redisexception对象报出连接错误。
echo
description
sends a string to redis, which replies with the same string
发送一个字符串到redis,返回一个相同的字符串
parameters
string: the message to send.
return value
string: the same message.
get
description
get the value related to the specified key
取得与指定的键值相关联的值
parameters
key
return value
string or bool: if key didn't exist, false is returned. otherwise, the value related to this key is returned.
返回相关值或者bool值,如果key不存在,返回false。如果有相关的key和值返回值。
examples
$redis->get('key');
set
description
set the string value in argument as value of the key.
设置值到key
parameters
key
value
timeout (optional). calling setex is preferred if you want a timeout.
return value
bool true if the command is successful.
examples
$redis->set('key', 'value');
setex, psetex
description
set the string value in argument as value of the key, with a time to live. psetex uses a ttl in milliseconds.
设置一个有生命周期的key-value,psetex()使用的周期单位为毫秒。
parameters
key ttl value
return value
bool true if the command is successful.
examples
$redis->setex('key', 3600, 'value'); // sets key → value, with 1h ttl.
$redis->psetex('key', 100, 'value'); // sets key → value, with 0.1 sec ttl.
setnx
description
set the string value in argument as value of the key if the key doesn't already exist in the database.
setnx用于设置一个key-value,这个函数会先判断redis中是否有这个key,如果没有就set,有就返回false。
parameters
key value
return value
bool true in case of success, false in case of failure.
examples
$redis->setnx('key', 'value'); /* return true */
$redis->setnx('key', 'value'); /* return false */
del, delete
description
remove specified keys.
移除已经存在keys   www.2cto.com
parameters
an array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyn
可以是一个keys的数组,或者一个未定义的数字参数,或者一个一个的写key
return value
long number of keys deleted.
返回删除key-value的数量
examples
$redis->set('key1', 'val1');
$redis->set('key2', 'val2');
$redis->set('key3', 'val3');
$redis->set('key4', 'val4');
$redis->delete('key1', 'key2'); /* return 2 */
$redis->delete(array('key3', 'key4')); /* return 2 */
作者:四云麒麟
http://www.bkjia.com/phpjc/478095.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/478095.htmltecharticleping description check the current connection status 检查当前连接实例的状态 parameters (none) return value string: +pong on success. throws a redisexception object on co...
其它类似信息

推荐信息