class Rabl::CacheEngine::LRU

A Hash holding at most max_size entries, which drops the entries added first

Attributes

max_size[RW]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/rabl/cache_engine.rb, line 16
def initialize
  super
  self.max_size = 100_000
end

Public Instance Methods

[]=(k,v) click to toggle source
Calls superclass method
# File lib/rabl/cache_engine.rb, line 21
def []= k,v
  r = super
  limit_size
  r
end
limit_size() click to toggle source
# File lib/rabl/cache_engine.rb, line 27
def limit_size
  shift while size > max_size
end