Class: LaunchDarkly::ThreadSafeMemoryStore
- Inherits:
-
Object
- Object
- LaunchDarkly::ThreadSafeMemoryStore
- Defined in:
- lib/ldclient-rb/store.rb
Overview
A thread-safe in-memory store suitable for use with the Faraday caching HTTP client. Uses the Threadsafe gem as the underlying cache.
Instance Method Summary collapse
-
#initialize ⇒ ThreadSafeMemoryStore
constructor
Default constructor.
-
#read(key) ⇒ Object
Read a value from the cache.
-
#write(key, value) ⇒ Object
Store a value in the cache.
Constructor Details
#initialize ⇒ ThreadSafeMemoryStore
Default constructor
17 18 19 |
# File 'lib/ldclient-rb/store.rb', line 17 def initialize @cache = ThreadSafe::Cache.new end |
Instance Method Details
#read(key) ⇒ Object
Read a value from the cache
26 27 28 |
# File 'lib/ldclient-rb/store.rb', line 26 def read(key) @cache[key] end |
#write(key, value) ⇒ Object
Store a value in the cache
36 37 38 |
# File 'lib/ldclient-rb/store.rb', line 36 def write(key, value) @cache[key] = value end |