class MiniMime::Db::Cache

Public Class Methods

new(size) click to toggle source
# File lib/mini_mime.rb, line 78
def initialize(size)
  @size = size
  @hash = {}
end

Public Instance Methods

[]=(key, val) click to toggle source
# File lib/mini_mime.rb, line 83
def []=(key, val)
  rval = @hash[key] = val
  @hash.shift if @hash.length > @size
  rval
end
fetch(key, &blk) click to toggle source
# File lib/mini_mime.rb, line 89
def fetch(key, &blk)
  @hash.fetch(key, &blk)
end