Sha256: bf663a84f8d42543821d16bcf744fe16035aea814e5d36d572394ddb442794a5
Contents?: true
Size: 446 Bytes
Versions: 4
Compression:
Stored size: 446 Bytes
Contents
require 'speed_gun/store/base' class SpeedGun::Store::Memory < SpeedGun::Store::Base DEFAULT_MAX_ENTRIES = 100 def initialize(options = {}) @max_entries = options[:max_entries] || DEFAULT_MAX_ENTRIES @store = {} @stored_list = [] end def [](id) @store[id] end def []=(id, val) @store[id] = val @stored_list.push(id) @store.delete(@stored_list.shift) while @stored_list.length > @max_entries end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
speed_gun-0.0.4 | lib/speed_gun/store/memory.rb |
speed_gun-0.0.3 | lib/speed_gun/store/memory.rb |
speed_gun-0.0.2 | lib/speed_gun/store/memory.rb |
speed_gun-0.0.1 | lib/speed_gun/store/memory.rb |