Sha256: f9f9a281d58079a47c8af7ac060e33ae90dc351a5e4bdd8f15545c0f0cf6baf6
Contents?: true
Size: 549 Bytes
Versions: 6
Compression:
Stored size: 549 Bytes
Contents
require 'thread' require 'clarion/counters/base' module Clarion module Counters class Memory < Base def initialize(*) super @lock = Mutex.new @counters = {} end def get(key) @lock.synchronize do @counters[key.handle] end end def store(key) @lock.synchronize do counter = @counters[key.handle] if !counter || key.counter > counter @counters[key.handle] = key.counter end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems