class LaunchDarkly::ThreadSafeMemoryStore

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.

@private

Public Class Methods

new() click to toggle source

Default constructor

@return [ThreadSafeMemoryStore] a new store

# File lib/ldclient-rb/cache_store.rb, line 15
def initialize
  @cache = Concurrent::Map.new
end

Public Instance Methods

delete(key) click to toggle source

Delete a value in the cache @param key [Object] the cache key

# File lib/ldclient-rb/cache_store.rb, line 41
def delete(key)
  @cache.delete(key)
end
read(key) click to toggle source

Read a value from the cache @param key [Object] the cache key

@return [Object] the cache value

# File lib/ldclient-rb/cache_store.rb, line 24
def read(key)
  @cache[key]
end
write(key, value) click to toggle source

Store a value in the cache @param key [Object] the cache key @param value [Object] the value to associate with the key

@return [Object] the value

# File lib/ldclient-rb/cache_store.rb, line 34
def write(key, value)
  @cache[key] = value
end