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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/rpc_mapper/cacheable.rb', line 63

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