Class: MemoryCache

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rinfo/cache.rb

Instance Method Summary collapse

Constructor Details

#initializeMemoryCache

create a private instance of MemoryStore



7
8
9
# File 'lib/rinfo/cache.rb', line 7

def initialize
  @memory_store = ::ActiveSupport::Cache::MemoryStore.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object

this will allow our MemoryCache to be called just like Rails.cache every method passed to it will be passed to our MemoryStore



13
14
15
# File 'lib/rinfo/cache.rb', line 13

def method_missing(m, *args, &block)
  @memory_store.send(m, *args, &block)
end