Class: CustomCache::RequestCache

Inherits:
ScopeCache show all
Includes:
Singleton
Defined in:
lib/custom_cache/request_cache.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_EXPIRY

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScopeCache

#cached_content, #clear, #read, #write

Class Method Details

.clear!Object



15
16
17
# File 'lib/custom_cache/request_cache.rb', line 15

def self.clear!
  self.instance.clear
end

.create(request_id) ⇒ Object



7
8
9
# File 'lib/custom_cache/request_cache.rb', line 7

def self.create(request_id)
  Thread.current[:request_id] = request_id
end

Instance Method Details

#scopeObject



11
12
13
# File 'lib/custom_cache/request_cache.rb', line 11

def scope
  "_request_#{Thread.current[:request_id]}_cache" if Thread.current[:request_id].present?
end