Module: RPCMapper::Cacheable

Defined in:
lib/rpc_mapper/cacheable.rb,
lib/rpc_mapper/cacheable/entry.rb,
lib/rpc_mapper/cacheable/store.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: Entry, Store

Class Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/rpc_mapper/cacheable.rb', line 51

def self.included(receiver)
  receiver.class_inheritable_accessor :cache_expires, :cache_record_count_threshold
  receiver.send :attr_accessor, :fresh

  receiver.extend         ClassMethods
  receiver.send :include, InstanceMethods

  # TRP: Remap calls for RPC through the caching mechanism
  receiver.class_eval do
    class << self
      alias_method :fetch_records_without_caching, :fetch_records
      alias_method :fetch_records, :fetch_records_with_caching
    end
  end

end