Class: MemoryCache
Instance Method Summary collapse
-
#initialize ⇒ MemoryCache
constructor
create a private instance of MemoryStore.
-
#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.
Constructor Details
#initialize ⇒ MemoryCache
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 |