Use Gitlab::SafeRequestStore instead of RequestStore

parent 1c9b415d
...@@ -84,24 +84,24 @@ module Gitlab ...@@ -84,24 +84,24 @@ module Gitlab
end end
def self.cache_value(raw_key, &block) def self.cache_value(raw_key, &block)
return yield unless RequestStore.active? return yield unless Gitlab::SafeRequestStore.active?
key = cache_key_for(raw_key) key = cache_key_for(raw_key)
RequestStore.fetch(key) do Gitlab::SafeRequestStore.fetch(key) do
# We need a short expire time as we can't manually expire on a secondary node # We need a short expire time as we can't manually expire on a secondary node
Rails.cache.fetch(key, expires_in: 15.seconds) { yield } Rails.cache.fetch(key, expires_in: 15.seconds) { yield }
end end
end end
def self.expire_cache! def self.expire_cache!
return true unless RequestStore.active? return true unless Gitlab::SafeRequestStore.active?
CACHE_KEYS.each do |raw_key| CACHE_KEYS.each do |raw_key|
key = cache_key_for(raw_key) key = cache_key_for(raw_key)
Rails.cache.delete(key) Rails.cache.delete(key)
RequestStore.delete(key) Gitlab::SafeRequestStore.delete(key)
end end
true true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment