SET
AttentionThis page documents an earlier version. Go to the latest (v2.1)version.
Synopsis
SET key string_value [EX seconds] [PX milliseconds] [NX|XX]
This command inserts string_value
to be hold at key
, where EX seconds
sets the expire time in seconds
, PX milliseconds
sets the expire time in milliseconds
, NX
sets the key only if it does not already exist, and XX
sets the key only if it already exists.
- If the
key
is already associated with a value, it is overwritten regardless of its type. - All parameters that are associated with the
key
, such as datatype and time to live, are discarded.
Return Value
Returns status string.
Examples
You can do this as shown below.
$ SET yugakey "Yugabyte"
"OK"
$ GET yugakey
"Yugabyte"
See Also
append
, get
, getrange
, getset
, incr
, incrby
, setrange
, strlen
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .