Class: Certmeister::Redis::Store
- Inherits:
-
Object
- Object
- Certmeister::Redis::Store
- Includes:
- Enumerable
- Defined in:
- lib/certmeister/redis/store.rb
Instance Method Summary collapse
- #each ⇒ Object
- #fetch(cn) ⇒ Object
- #health_check ⇒ Object
-
#initialize(redis, environment = "development") ⇒ Store
constructor
A new instance of Store.
- #remove(cn) ⇒ Object
- #store(cn, pem) ⇒ Object
Constructor Details
#initialize(redis, environment = "development") ⇒ Store
Returns a new instance of Store.
9 10 11 12 13 |
# File 'lib/certmeister/redis/store.rb', line 9 def initialize(redis, environment = "development") @redis = redis @environment = environment @healthy = true end |
Instance Method Details
#each ⇒ Object
28 29 30 31 32 33 |
# File 'lib/certmeister/redis/store.rb', line 28 def each @redis.scan_each do |key| cn = cn_from_pem_key(key) yield cn, fetch(cn) end end |
#fetch(cn) ⇒ Object
19 20 21 |
# File 'lib/certmeister/redis/store.rb', line 19 def fetch(cn) @redis.get(pem_key(cn)) end |
#health_check ⇒ Object
35 36 37 |
# File 'lib/certmeister/redis/store.rb', line 35 def health_check @healthy end |
#remove(cn) ⇒ Object
23 24 25 26 |
# File 'lib/certmeister/redis/store.rb', line 23 def remove(cn) num_removed = @redis.del(pem_key(cn)) num_removed == 1 end |
#store(cn, pem) ⇒ Object
15 16 17 |
# File 'lib/certmeister/redis/store.rb', line 15 def store(cn, pem) @redis.set(pem_key(cn), pem) end |