Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Dragonfly::SimpleCache

Attributes

max_size[R]

Public Class Methods

new(max_size) click to toggle source
# File lib/dragonfly/simple_cache.rb, line 4
def initialize(max_size)
  @max_size = max_size
  @keys = []
end

Public Instance Methods

[]=(key, value) click to toggle source
# File lib/dragonfly/simple_cache.rb, line 11
def []=(key, value)
  if !has_key?(key)
    @keys << key
    if size == max_size
      key_to_purge = @keys.shift
      delete(key_to_purge)
    end
  end
  super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.