class Ramaze::Cache::LRU

Cache class that uses {Ramaze::LRUHash} as a storage engine. This cache has the advantage that unlike Innate::Cache::Memory it does not leak memory over time when using the cache for sessions.

@example

Ramaze::Cache.options.session = Ramaze::Cache::LRU
Ramaze.setup_dependencies

@author Michael Fellinger @since 17-07-2009

Constants

OPTIONS

Hash containing all the options for the cache.

Public Instance Methods

cache_clear() click to toggle source

Clears the entire cache.

@author Michael Fellinger @since 17-07-2009

# File lib/ramaze/cache/lru.rb, line 50
def cache_clear
  @store.clear
end
cache_delete(*args) click to toggle source

Deletes a set of data from the cache

@author Michael Fellinger @since 17-07-2009 @see Innate::Cache::API#cache_delete

Calls superclass method
# File lib/ramaze/cache/lru.rb, line 83
def cache_delete(*args)
  super { |key| @store.delete(key) }
end
cache_fetch(*args) click to toggle source

Retrieves a set of data from the cache.

@author Michael Fellinger @since 17-07-2009 @see Innate::Cache::API#cache_fetch

Calls superclass method
# File lib/ramaze/cache/lru.rb, line 72
def cache_fetch(*args)
  super { |key| @store[key] }
end
cache_setup(host, user, app, name) click to toggle source

Prepares the cache by creating a new instance of Ramaze::LRUHash using the options set in {Ramaze::Cache::LRU::OPTIONS}.

@author Michael Fellinger @since 17-07-2009

# File lib/ramaze/cache/lru.rb, line 40
def cache_setup(host, user, app, name)
  @store = Ramaze::LRUHash.new(OPTIONS)
end
cache_store(*args) click to toggle source

Stores a set of data in the cache.

@author Michael Fellinger @since 17-07-2009 @see Innate::Cache::API#cache_store

Calls superclass method
# File lib/ramaze/cache/lru.rb, line 61
def cache_store(*args)
  super { |key, value| @store[key] = value }
end