Module: CachedResource

Defined in:
lib/cached_resource.rb,
lib/cached_resource/config.rb,
lib/cached_resource/caching.rb,
lib/cached_resource/version.rb

Defined Under Namespace

Modules: Caching Classes: Config

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.cacheObject

retrieve the configured cache store



27
28
29
# File 'lib/cached_resource.rb', line 27

def self.cache
  config.cache
end

.configObject

Retrieve the configuration object



32
33
34
# File 'lib/cached_resource.rb', line 32

def self.config
  @@config ||= CachedResource::Config.instance
end

.loggerObject

retrieve the configured logger



22
23
24
# File 'lib/cached_resource.rb', line 22

def self.logger
  config.logger
end

.off!Object

Switch cache usage off



12
13
14
# File 'lib/cached_resource.rb', line 12

def self.off!
  self.config.cache_enabled = false
end

.on!Object

Switch cache usage on



17
18
19
# File 'lib/cached_resource.rb', line 17

def self.on!
  self.config.cache_enabled = true
end