Class Ramaze::Cache::LRU
In: lib/ramaze/cache/lru.rb
Parent: Object

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

Methods

Included Modules

Cache::API

Constants

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, }   Hash containing all the options for the cache.

Public Instance methods

Clears the entire cache.

@author Michael Fellinger @since 17-07-2009

Deletes a set of data from the cache

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

Retrieves a set of data from the cache.

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

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

Stores a set of data in the cache.

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

[Validate]