Class: GH::Cache

Inherits:
Wrapper show all
Defined in:
lib/gh/cache.rb

Overview

Public: This class caches responses.

Defined Under Namespace

Classes: SimpleCache

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#backend, #options

Instance Method Summary collapse

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

#cacheObject

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

#resetObject

Public: …



41
42
43
44
# File 'lib/gh/cache.rb', line 41

def reset
  super
  clear_partial or clear_all
end

#setupObject

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