Method: Gitlab::Cache::Import::Caching.write

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

.write(raw_key, value, timeout: TIMEOUT) ⇒ Object

Sets a cache key to the given value.

raw_key - The cache key to write. value - The value to set. timeout - The time after which the cache key should expire.



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/gitlab/cache/import/caching.rb', line 67

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

  key = cache_key_for(raw_key)

  with_redis do |redis|
    redis.set(key, value, ex: timeout)
  end

  value
end