Sha256: efcb8a3a743377632d82359d380683e4eebfa8c7c511a487f10aec6908154aa4
Contents?: true
Size: 388 Bytes
Versions: 76
Compression:
Stored size: 388 Bytes
Contents
module Dragonfly class SimpleCache < Hash def initialize(max_size) @max_size = max_size @keys = [] end attr_reader :max_size 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 end end
Version data entries
76 entries across 76 versions & 4 rubygems