Method: Gitlab::Cache::Import::Caching.hash_add

Defined in:
lib/gitlab/cache/import/caching.rb

.hash_add(raw_key, field, value, timeout: TIMEOUT) ⇒ Object

Adds a value to a hash.

raw_key - The key of the hash to add to. field - The field to add to the hash. value - The field value to add to the hash. timeout - The new timeout of the key.



253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/gitlab/cache/import/caching.rb', line 253

def self.hash_add(raw_key, field, value, timeout: TIMEOUT)
  validate_redis_value!(value)

  key = cache_key_for(raw_key)

  with_redis do |redis|
    redis.multi do |m|
      m.hset(key, field, value)
      m.expire(key, timeout)
    end
  end
end