Method: Conflow::Redis::HashField#overwrite

Defined in:
lib/conflow/redis/hash_field.rb

#overwrite(new_hash) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Replaces currently stored hash with one given as param

Examples:

field.overwrite(smart: true, degree: :none)

Parameters:

  • new_hash (Hash)

    hash of keys and values to be stored

Returns:

  • (String)

    Redis response



26
27
28
29
30
31
32
33
# File 'lib/conflow/redis/hash_field.rb', line 26

def overwrite(new_hash)
  redis.with do |conn|
    conn.pipelined do
      conn.del(key)
      conn.hmset(key, prepare_hash(new_hash).flatten)
    end
  end
end