Sha256: f495695d8000fb726b9f35809d73c944693308eb8ac5806ec5086a0d931d9222
Contents?: true
Size: 654 Bytes
Versions: 2
Compression:
Stored size: 654 Bytes
Contents
# frozen_string_literal: true require_relative '../time_helper/monotonic' class Circuitbox class MemoryStore class Container include TimeHelper::Monotonic attr_accessor :value def initialize(value:, expiry: 0) @value = value expires_after(expiry) end def expired? @expires_after.positive? && @expires_after < current_second end def expired_at?(clock_second) @expires_after.positive? && @expires_after < clock_second end def expires_after(seconds = 0) @expires_after = seconds.zero? ? seconds : current_second + seconds end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
circuitbox-2.0.0 | lib/circuitbox/memory_store/container.rb |
circuitbox-2.0.0.pre5 | lib/circuitbox/memory_store/container.rb |