Sha256: 611f216689f0273b0192100a4f5c4ef64bbf496b6474515df699c93cd09e3e41

Contents?: true

Size: 377 Bytes

Versions: 10

Compression:

Stored size: 377 Bytes

Contents

module Alephant
  module Broker
    module Cache
      class NullClient
        def initialize
          @cache = {}
        end

        def get(key)
          data = @cache[key]

          return data if data

          set(key, yield) if block_given?
        end

        def set(key, value, _ttl = nil)
          @cache[key] = value
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
alephant-broker-3.19.1 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.19.0 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.18.0 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.17.0 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.16.2 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.16.1 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.16.0 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.15.2 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.15.1 lib/alephant/broker/cache/null_client.rb
alephant-broker-3.15.0 lib/alephant/broker/cache/null_client.rb