企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 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*`<span class="calibre12">TRUE</span>` in case of success, `<span class="calibre12">FALSE</span>` in case of failure. ##### Examples ``` <pre class="calibre9">$redis->setnx('key', 'value'); /* return TRUE */ $redis->setnx('key', 'value'); /* return FALSE */ ```