企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
// 普通 set/get 操作 ~~~ $redis->set('test:str1', 'predis'); $ret = $redis->get('test:str1'); echo $ret; ~~~ // setnx 只有在 key 不存在时设置 key 的值 ~~~ $redis->setnx('test:str3', 'str3-v'); $ret = $redis->get('test:str3'); echo $ret; ~~~ // incrby/incr/decrby/decr 对值的递增和递减 ~~~ $redis->set('test:str2', 1); $redis->incr('test:str2'); $redis->incrby('test:str2', 4); echo $redis->decr('test:str2'); echo $redis->decrby('test:str2', 2); echo $redis->get('test:str2'); ~~~