class Clarion::Stores::Memory

Public Class Methods

new(*) click to toggle source
Calls superclass method Clarion::Stores::Base::new
# File lib/clarion/stores/memory.rb, line 8
def initialize(*)
  super
  @lock = Mutex.new
  @store = {}
end

Public Instance Methods

find_authn(id) click to toggle source
# File lib/clarion/stores/memory.rb, line 20
def find_authn(id)
  @lock.synchronize do
    unless @store.key?(id)
      return nil
    end
    Authn.new(**@store[id])
  end
end
store_authn(authn) click to toggle source
# File lib/clarion/stores/memory.rb, line 14
def store_authn(authn)
  @lock.synchronize do
    @store[authn.id] = authn.to_h(:all)
  end
end