Class LRUHash
In: lib/hashery/lruhash.rb
Parent: Object

Hash with LRU expiry policy. There are at most max_size elements in a LRUHash. When adding more elements old elements are removed according to LRU policy.

github.com/rklemme/muppet-laboratories/blob/master/lib/lruhash.rb Copyright (c) 2010 Robert Klemme

Methods

[]   []=   assoc   clear   delete   delete_if   each   each_key   each_pair   each_value   empty?   fetch   has_key?   has_value?   include?   inspect   key   key?   keys   max_size=   member?   new   rassoc   size   store   to_s   value?   values   values_at  

Included Modules

Enumerable

Constants

FETCH = Proc.new {|k| raise KeyError, 'key not found'}  
Node = Struct.new :key, :value, :pred, :succ do def unlink   A single node in the doubly linked LRU list of nodes

Attributes

default  [RW] 
default_proc  [RW] 
max_size  [R] 
release_proc  [RW] 

Public Class methods

Public Instance methods

[]=(key, value)

Alias for store

each()

Alias for each_pair

include?(key)

Alias for has_key?

inspect()

Alias for to_s

key?(key)

Alias for has_key?

member?(key)

Alias for has_key?

value?(value)

Alias for has_value?

[Validate]