Method: Redis#hsetnx

Defined in:
lib/redis.rb

#hsetnx(key, field, value) ⇒ Boolean

Set the value of a hash field, only if the field does not exist.

Parameters:

  • key (String)
  • field (String)
  • value (String)

Returns:

  • (Boolean)

    whether or not the field was added to the hash



1329
1330
1331
1332
1333
# File 'lib/redis.rb', line 1329

def hsetnx(key, field, value)
  synchronize do
    @client.call [:hsetnx, key, field, value], &_boolify
  end
end