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, #frontend, #options

Instance Method Summary collapse

Methods inherited from Wrapper

#[], [], double_dispatch, #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.



9
10
11
# File 'lib/gh/cache.rb', line 9

def cache
  @cache
end

Instance Method Details

#resetObject

Public: …



55
56
57
58
# File 'lib/gh/cache.rb', line 55

def reset
  super
  clear_partial or clear_all
end

#setupObject

Internal: Initializes a new Cache instance.



47
48
49
50
51
52
# File 'lib/gh/cache.rb', line 47

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