Module Cachetastic::Adapters
In: lib/cachetastic/adapters/base.rb
lib/cachetastic/adapters/file.rb
lib/cachetastic/adapters/local_memory.rb
lib/cachetastic/adapters/memcached.rb

Methods

build  

Classes and Modules

Class Cachetastic::Adapters::Base
Class Cachetastic::Adapters::File
Class Cachetastic::Adapters::LocalMemory
Class Cachetastic::Adapters::Memcached

Public Class methods

This method will return the appropriate Cachetastic::Adapters::Base class that is defined for the Class passed in. If an adapter has not been defined for the Class than the default adapter is returned.

Examples:

  configatron.cachetastic.defaults.adapter = Cachetastic::Adapters::LocalMemory
  configatron.cachetastic.user.adapter = Cachetastic::Adapters::Memcached
  Cachetastic::Adapters.build(User).class # => Cachetastic::Adapters::Memcached
  Cachetastic::Adapters.build(Comment).class # => Cachetastic::Adapters::LocalMemory

[Source]

    # File lib/cachetastic/adapters/base.rb, line 16
16:       def build(klass)
17:         adp = klass.to_configatron(:cachetastic).adapter
18:         if adp.nil?
19:           adp = configatron.cachetastic.defaults.adapter
20:         end
21:         adp.new(klass)
22:       end

[Validate]