Module: Gitlab::SafeRequestStore

Defined in:
lib/gitlab/safe_request_store.rb

Constant Summary collapse

NULL_STORE =
Gitlab::NullRequestStore.new

Class Method Summary collapse

Class Method Details

.storeObject


15
16
17
18
19
20
21
# File 'lib/gitlab/safe_request_store.rb', line 15

def self.store
  if RequestStore.active?
    RequestStore
  else
    NULL_STORE
  end
end

.write(key, value, options = nil) ⇒ Object

This method accept an options hash to be compatible with ActiveSupport::Cache::Store#write method. The options are not passed to the underlying cache implementation because RequestStore#write accepts only a key, and value params.


27
28
29
# File 'lib/gitlab/safe_request_store.rb', line 27

def self.write(key, value, options = nil)
  store.write(key, value)
end