Class: Ramaze::Cache::LRU
- Includes:
- Cache::API
- Defined in:
- lib/ramaze/cache/lru.rb
Constant Summary collapse
- OPTIONS =
{ # expiration in seconds :expiration => nil, # maximum elements in the cache :max_count => 10000, # maximum total memory usage of the cache :max_total => nil, # maximum memory usage of an element of the cache :max_value => nil, }
Instance Method Summary collapse
- #cache_clear ⇒ Object
- #cache_delete(*args) ⇒ Object
- #cache_fetch(*args) ⇒ Object
-
#cache_setup(host, user, app, name) ⇒ Object
Connect to localmemcache.
- #cache_store(*args) ⇒ Object
Instance Method Details
#cache_clear ⇒ Object
25 26 27 |
# File 'lib/ramaze/cache/lru.rb', line 25 def cache_clear @store.clear end |
#cache_delete(*args) ⇒ Object
37 38 39 |
# File 'lib/ramaze/cache/lru.rb', line 37 def cache_delete(*args) super{|key| @store.delete(key) } end |
#cache_fetch(*args) ⇒ Object
33 34 35 |
# File 'lib/ramaze/cache/lru.rb', line 33 def cache_fetch(*args) super{|key| @store[key] } end |
#cache_setup(host, user, app, name) ⇒ Object
Connect to localmemcache
21 22 23 |
# File 'lib/ramaze/cache/lru.rb', line 21 def cache_setup(host, user, app, name) @store = Ramaze::LRUHash.new(OPTIONS) end |
#cache_store(*args) ⇒ Object
29 30 31 |
# File 'lib/ramaze/cache/lru.rb', line 29 def cache_store(*args) super{|key, value| @store[key] = value } end |