Class: Certmeister::InMemoryStore

Inherits:
Object
  • Object
show all
Defined in:
lib/certmeister/in_memory_store.rb

Instance Method Summary collapse

Constructor Details

#initialize(certs = {}) ⇒ InMemoryStore



7
8
9
10
# File 'lib/certmeister/in_memory_store.rb', line 7

def initialize(certs = {})
  @certs = certs
  @healthy = true
end

Instance Method Details

#fetch(cn) ⇒ Object



17
18
19
20
# File 'lib/certmeister/in_memory_store.rb', line 17

def fetch(cn)
  fail_if_unhealthy
  @certs[cn]
end

#health_checkObject



27
28
29
# File 'lib/certmeister/in_memory_store.rb', line 27

def health_check
  @healthy
end

#remove(cn) ⇒ Object



22
23
24
25
# File 'lib/certmeister/in_memory_store.rb', line 22

def remove(cn)
  fail_if_unhealthy
  !!@certs.delete(cn)
end

#store(cn, cert) ⇒ Object



12
13
14
15
# File 'lib/certmeister/in_memory_store.rb', line 12

def store(cn, cert)
  fail_if_unhealthy
  @certs[cn] = cert
end