Class Iowa::LRUCache
In: src/LRUCache.rb
Parent: Object

Simple LRU cache for caching pages.

Methods

[]   []=   add_finalizer   do_finalization   include?   maxsize   maxsize=   new   queue   size   size=  

Public Class methods

Initialize the empty LRU cache, and set the maximum number of elements that it will contain or the max time to live (in seconds) of a cache item. If both a max and a maxttl are set, the max is a hard maximum that will not be exceeded.

Public Instance methods

Return the element identified by the given key.

Set the element of the cache identified by the given key.

Adds a finalization method to the cache that will be called before the object in the cache is expired.

Is called when an object in the cache is expired. Iterates through the defined finalization methods, if any.

Check to see if the cache contains the given key.

Return the maximum size of the cache.

maxsize=(max)

Alias for size=

Return a copy of current set of keys to cache elements.

Return the current size of the cache.

Allows one to set the maximum size of the cache queue. If the queue is currently larger than the size that it is being set to, elements will be expired until the queue is at the maximum size.

[Validate]