Sha256: 764418b3672ce77e4114cd5c1c29d431f9b78c92ac04a417d0f39bebf9387f23
Contents?: true
Size: 563 Bytes
Versions: 184
Compression:
Stored size: 563 Bytes
Contents
module SplitIoClient module Observers class ImpressionObserver LAST_SEEN_CACHE_SIZE = 500000 def initialize @cache = LruRedux::TTL::ThreadSafeCache.new(LAST_SEEN_CACHE_SIZE) @impression_hasher = Hashers::ImpressionHasher.new end def test_and_set(impression) return if impression.nil? hash = @impression_hasher.process(impression) previous = @cache[hash] @cache[hash] = impression[:m] previous.nil? ? nil : [previous, impression[:m]].min end end end end
Version data entries
184 entries across 184 versions & 1 rubygems