redis HSETNX command
Translation results:
set
英[set] 美[sɛt]
vt. Set; place, arrange; put in a certain situation; place tableware
vi. Setting off; setting off; condensation
n.Gathering; a set; a set; a TV set
adj. Fixed; located in...; stubborn; arranged The
third person singular: sets plural: sets present participle: setting past tense: set past participle: set
redis HSETNX commandsyntax
Function: Set the value of the field field in the hash table key to value if and only if the field field does not exist.
Syntax: HSETNX key field value
Description: If the domain field already exists, this operation is invalid. If key does not exist, a new hash table is created and the HSETNX command is executed.
Available versions: >= 2.0.0
Time complexity: O(1)
Return: Set successfully, return 1. If the given domain already exists and no operations were performed, 0 is returned.
redis HSETNX commandexample
redis> HSETNX nosql key-value-store redis (integer) 1 redis> HSETNX nosql key-value-store redis # 操作无效,域 key-value-store 已存在 (integer) 0