Returns | True if the hash was set, otherwise false |
---|---|
Keys |
|
Args |
|
> evalsha 8c4bbf1b37784149128a5b96e55073538a7401d9 1 mykey foo 1 bar 2 (integer) 1 > hgetall mykey 1) "foo" 2) "1" 3) "bar" 4) "2" > evalsha 8c4bbf1b37784149128a5b96e55073538a7401d9 1 mykey foo 1 bar 3 baz 4 (integer) 0 > hgetall mykey 1) "foo" 2) "1" 3) "bar" 4) "2"
if redis.call('exists', KEYS[1]) == 0 then redis.call('hmset', KEYS[1], unpack(ARGV)) return 1 end return 0
← More scripts from the Memetria Library
All scripts on this site are in the public domain, unless otherwise noted, and are provided without warranty express or implied. Memetria make no claim for the effectiveness, safety, security or quality of the scripts contained within.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.