Sha256: 498d4d4e27862b5141870499c8fdb47ab6d1e5e414c96ac6da10adfed1766424

Contents?: true

Size: 416 Bytes

Versions: 4

Compression:

Stored size: 416 Bytes

Contents

# frozen_string_literal: true

require "concurrent/hash"

module JwkLoader
  class MemoryCache
    def initialize
      @data = ::Concurrent::Hash.new
    end

    def fetch(key)
      data.fetch(key, nil)
    end

    def store(key, value)
      data.store(key, value)
    end

    def delete(key)
      data.delete(key)
    end

    def clear
      data.clear
    end

    private

    attr_reader :data
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jwk-loader-1.1.0 lib/jwk_loader/memory_cache.rb
jwk-loader-1.0.0 lib/jwk_loader/memory_cache.rb
jwk-loader-0.1.1 lib/jwk_loader/memory_cache.rb
jwk-loader-0.1.0 lib/jwk_loader/memory_cache.rb