ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## hSetNx ##### *Description* Adds a value to the hash stored at key only if this field isn't already in the hash. 添加一个VALUE到HASH STORE中,如果FIELD不存在。 ##### *Return value* *BOOL*`<span class="calibre12">TRUE</span>` if the field was set, `<span class="calibre12">FALSE</span>` if it was already present. ##### *Example* ``` <pre class="calibre16">$redis->delete('h') $redis->hSetNx('h', 'key1', 'hello'); /* TRUE, 'key1' => 'hello' in the hash at "h" */ $redis->hSetNx('h', 'key1', 'world'); /* FALSE, 'key1' => 'hello' in the hash at "h". No change since the field wasn't replaced. */ ``` ##