Sha256: 968dd1185f4ccc6d16a96a3b41fd3ed71b692f7e37af4b52a687b5a1ff6ea9ff

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

dir = File.dirname(__FILE__)
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)

require 'arid_cache/helpers'
require 'arid_cache/store'
require 'arid_cache/active_record'
require 'arid_cache/cache_proxy'
require 'arid_cache/railtie' if defined?(Rails)
require 'arid_cache/inflector'

module AridCache
  extend AridCache::Helpers
  Error = Class.new(StandardError) #:nodoc:

  # Set to true to make the :raw option return ids after applying options to them.
  # The deprecated behaviour is to return a CachedResult and ignore all options.
  def self.raw_with_options=(value)
    @raw_with_options = value
  end

  def self.raw_with_options
    !!@raw_with_options
  end

  def self.cache
    AridCache::CacheProxy
  end

  def self.clear_caches
    AridCache::CacheProxy.clear_caches
  end

  def self.clear_class_caches(object)
    AridCache::CacheProxy.clear_class_caches(object)
  end

  def self.clear_instance_caches(object)
    AridCache::CacheProxy.clear_instance_caches(object)
  end

  def self.store
    AridCache::Store.instance
  end

  # The old method of including this module, if you don't want to
  # extend active record.  Just add 'include AridCache' to your
  # model class.
  def self.included(base)
    base.send(:include, AridCache::ActiveRecord)
  end

  # Initializes AridCache for Rails.
  #
  # This method is called by `init.rb`,
  # which is run by Rails on startup.
  def self.init_rails
    ::ActiveRecord::Base.send(:include, AridCache::ActiveRecord)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arid_cache-1.3.6 lib/arid_cache.rb
arid_cache-1.3.5 lib/arid_cache.rb
arid_cache-1.3.4 lib/arid_cache.rb
arid_cache-1.3.3 lib/arid_cache.rb
arid_cache-1.3.2 lib/arid_cache.rb