Class: GH::Cache
Overview
Public: This class caches responses.
Defined Under Namespace
Classes: SimpleCache
Instance Attribute Summary collapse
-
#cache ⇒ Object
Public: Get/set cache to use.
Attributes inherited from Wrapper
Instance Method Summary collapse
-
#reset ⇒ Object
Public: …
-
#setup ⇒ Object
Internal: Initializes a new Cache instance.
Methods inherited from Wrapper
[], #[], #frontend, #frontend=, #generate_response, #initialize, #inspect, #load, #prefixed, wraps
Constructor Details
This class inherits a constructor from GH::Wrapper
Instance Attribute Details
#cache ⇒ Object
Public: Get/set cache to use. Compatible with Rails/ActiveSupport cache.
8 9 10 |
# File 'lib/gh/cache.rb', line 8 def cache @cache end |
Instance Method Details
#reset ⇒ Object
Public: …
41 42 43 44 |
# File 'lib/gh/cache.rb', line 41 def reset super clear_partial or clear_all end |
#setup ⇒ Object
Internal: Initializes a new Cache instance.
33 34 35 36 37 38 |
# File 'lib/gh/cache.rb', line 33 def setup(*) #self.cache ||= Rails.cache if defined? Rails.cache and defined? RAILS_CACHE #self.cache ||= ActiveSupport::Cache.lookup_store if defined? ActiveSupport::Cache.lookup_store self.cache ||= SimpleCache.new super end |