Class: TimedCache::MemoryStore
Overview
:nodoc:
Instance Method Summary collapse
- #get(key, timeout = @timed_cache.default_timeout, &block) ⇒ Object
-
#initialize(*args) ⇒ MemoryStore
constructor
A new instance of MemoryStore.
- #put(key, value, timeout) ⇒ Object
Constructor Details
#initialize(*args) ⇒ MemoryStore
Returns a new instance of MemoryStore.
159 160 161 162 |
# File 'lib/timedcache.rb', line 159 def initialize(*args) super(*args) @cache = Hash.new end |
Instance Method Details
#get(key, timeout = @timed_cache.default_timeout, &block) ⇒ Object
171 172 173 |
# File 'lib/timedcache.rb', line 171 def get(key, timeout = @timed_cache.default_timeout, &block) generic_get(key, timeout, block) end |
#put(key, value, timeout) ⇒ Object
164 165 166 167 168 169 |
# File 'lib/timedcache.rb', line 164 def put(key, value, timeout) @cache[key] = ObjectContainer.new(value, timeout) # Return just the given value, so that references to the # ObjectStore instance can't be held outside this TimedCache: value end |