Sha256: a1c5885e6514a05d508b6f6538b4d83e4026c211a703b30e5b1fdee31bf1115d

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

require 'singleton'
require 'stringio'

require 'active_support/concern'
require 'cached_resource/config'
require 'cached_resource/caching'
require 'cached_resource/version'

module CachedResource

  # Switch cache usage off
  def self.off!
    self.config.cache_enabled = false
  end

  # Switch cache usage on
  def self.on!
    self.config.cache_enabled = true
  end

  # retrieve the configured logger
  def self.logger
    config.logger
  end

  # retrieve the configured cache store
  def self.cache
    config.cache
  end

  # Retrieve the configuration object
  def self.config
    @@config ||= CachedResource::Config.instance
  end

end

# Include caching in ActiveResource::Base
class ActiveResource::Base
  include CachedResource::Caching
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cached_resource-1.0.1 lib/cached_resource.rb