class LRU
Defines the default cache engine for RABL when caching is invoked for a template. You can define your own caching engines by creating an object that responds to fetch and setting the configuration option:
config.cache_engine = AdvancedCacheEngine.new
Attributes
max_size[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/rabl/cache_engine.rb, line 11 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 16 def []= k,v r = super limit_size r end
limit_size()
click to toggle source
# File lib/rabl/cache_engine.rb, line 22 def limit_size if size > max_size then delete keys.shift while size > max_size end end