An Embeddable Datastore Engine |
Tweet |
Follow @Vedis |
Vedis Built-in Commands - Key/Value.
Command
SETNX key value
Description
Set key to hold string value if key does not exist. In that case, it is equal to SET. When key already holds a value, no operation is performed. SETNX is short for "SET if N ot e X ists".
Return value
Boolean: True on success. False otherwise.
Example
Refer to the download page for some C/C++ samples on how to invoke this command from your host application.
vedis> SETNX test "Hello"
(true)
vedis> SETNX message "Greeting!"
(true)
vedis> SETNX message "Bye Bye"
(false)
vedis> MGET test message
(1) Hello
(2) Greeting!
(true)
vedis> SETNX message "Greeting!"
(true)
vedis> SETNX message "Bye Bye"
(false)
vedis> MGET test message
(1) Hello
(2) Greeting!
Copyright © Symisc Systems