Class: LaunchDarkly::Impl::ThreadSafeMemoryStore Private
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::ThreadSafeMemoryStore
- Defined in:
- lib/ldclient-rb/impl/cache_store.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A thread-safe in-memory store that uses the same semantics that Faraday would expect, although we no longer use Faraday. This is used by Requestor, when we are not in a Rails environment.
Instance Method Summary collapse
-
#delete(key) ⇒ Object
private
Delete a value in the cache.
-
#initialize ⇒ ThreadSafeMemoryStore
constructor
private
Default constructor.
-
#read(key) ⇒ Object
private
Read a value from the cache.
-
#write(key, value) ⇒ Object
private
Store a value in the cache.
Constructor Details
#initialize ⇒ ThreadSafeMemoryStore
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Default constructor
12 13 14 |
# File 'lib/ldclient-rb/impl/cache_store.rb', line 12 def initialize @cache = Concurrent::Map.new end |
Instance Method Details
#delete(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Delete a value in the cache
38 39 40 |
# File 'lib/ldclient-rb/impl/cache_store.rb', line 38 def delete(key) @cache.delete(key) end |
#read(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Read a value from the cache
21 22 23 |
# File 'lib/ldclient-rb/impl/cache_store.rb', line 21 def read(key) @cache[key] end |
#write(key, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Store a value in the cache
31 32 33 |
# File 'lib/ldclient-rb/impl/cache_store.rb', line 31 def write(key, value) @cache[key] = value end |