Sha256: ed214ae21691a53fb4f3d90fc3d3ef01ea0d9d1c5ed425730fd2d5c875d69f7c

Contents?: true

Size: 547 Bytes

Versions: 6

Compression:

Stored size: 547 Bytes

Contents

require 'thread'
require 'clarion/stores/base'
require 'clarion/authn'

module Clarion
  module Stores
    class Memory < Base
      def initialize(*)
        super
        @lock = Mutex.new
        @store = {}
      end

      def store_authn(authn)
        @lock.synchronize do
          @store[authn.id] = authn.to_h(:all)
        end
      end

      def find_authn(id)
        @lock.synchronize do
          unless @store.key?(id)
            return nil
          end
          Authn.new(**@store[id])
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clarion-1.1.0 lib/clarion/stores/memory.rb
clarion-1.0.0 lib/clarion/stores/memory.rb
clarion-0.3.0 lib/clarion/stores/memory.rb
clarion-0.2.1 lib/clarion/stores/memory.rb
clarion-0.2.0 lib/clarion/stores/memory.rb
clarion-0.1.0 lib/clarion/stores/memory.rb