HSET
AttentionThis page documents an earlier version. Go to the latest (v2.1)version.
Synopsis
HSET key field value
This command sets the data for the given field
of the hash that is associated with the given key
with the given value
. If the field
already exists in the hash, it is overwritten.
- If the given
key
does not exist, an associated hash is created, and thefield
andvalue
are inserted. - If the given
key
is not associated with a hash, an error is raised.
Return Value
Depends on the configuration parameter emulate_redis_responses
.
- If
emulate_redis_responses
is true, returns1 if a new field is inserted and 0 if an existing field is updated. - If
emulate_redis_responses
is false, returnsOK
Examples
emulate_redis_responses
istrue
.
$ HSET yugahash area1 "America"
1
$ HSET yugahash area1 "North America"
0
$ HGET yugahash area1
"North America"
emulate_redis_responses
isfalse
.
$ HSET yugahash area1 "America"
"OK"
$ HSET yugahash area1 "North America"
"OK"
$ HGET yugahash area1
"North America"
See Also
hdel
, hexists
, hget
, hgetall
, hincrby
, hkeys
, hlen
, hmget
, hmset
, hstrlen
, hvals
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .