Class: Keratin::AuthN::FetchingKeychain

Inherits:
Object
  • Object
show all
Defined in:
lib/keratin/authn/fetching_keychain.rb

Instance Method Summary collapse

Constructor Details

#initialize(issuer:, ttl:) ⇒ FetchingKeychain

Returns a new instance of FetchingKeychain.



3
4
5
6
# File 'lib/keratin/authn/fetching_keychain.rb', line 3

def initialize(issuer:, ttl:)
  @cache = LruRedux::TTL::ThreadSafeCache.new(25, ttl)
  @issuer = issuer.chomp('/')
end

Instance Method Details

#[](kid) ⇒ Object



8
9
10
# File 'lib/keratin/authn/fetching_keychain.rb', line 8

def [](kid)
  @cache.getset(kid){ fetch(kid) }
end

#clearObject



12
13
14
# File 'lib/keratin/authn/fetching_keychain.rb', line 12

def clear
  @cache.clear
end