Class: LaunchDarkly::RedisFeatureStore Deprecated

Inherits:
Object
  • Object
show all
Includes:
Interfaces::FeatureStore
Defined in:
lib/ldclient-rb/redis_store.rb

Overview

Deprecated.

Use the factory method in Integrations::Redis instead. This specific implementation class may be changed or removed in the future.

An implementation of the LaunchDarkly client's feature store that uses a Redis instance. This object holds feature flags and related data received from the streaming API. Feature data can also be further cached in memory to reduce overhead of calls to Redis.

To use this class, you must first have the redis and connection-pool gems installed. Then, create an instance and store it in the feature_store property of your client configuration.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ RedisFeatureStore

Constructor for a RedisFeatureStore instance.

Parameters:

  • opts (Hash) (defaults to: {})

    the configuration options

Options Hash (opts):

  • :redis_url (String)

    URL of the Redis instance (shortcut for omitting redis_opts)

  • :redis_opts (Hash)

    options to pass to the Redis constructor (if you want to specify more than just redis_url)

  • :prefix (String)

    namespace prefix to add to all hash keys used by LaunchDarkly

  • :logger (Logger)

    a Logger instance; defaults to Config.default_logger

  • :max_connections (Integer)

    size of the Redis connection pool

  • :expiration (Integer)

    expiration time for the in-memory cache, in seconds; 0 for no local caching

  • :capacity (Integer)

    maximum number of feature flags (or related objects) to cache locally

  • :pool (Object)

    custom connection pool, if desired



39
40
41
42
# File 'lib/ldclient-rb/redis_store.rb', line 39

def initialize(opts = {})
  core = LaunchDarkly::Impl::Integrations::Redis::RedisFeatureStoreCore.new(opts)
  @wrapper = LaunchDarkly::Integrations::Util::CachingStoreWrapper.new(core, opts)
end

Class Method Details

.default_prefixObject

Default value for the prefix constructor parameter.



55
56
57
# File 'lib/ldclient-rb/redis_store.rb', line 55

def self.default_prefix
  LaunchDarkly::Integrations::Redis::default_prefix
end

.default_redis_urlObject

Default value for the redis_url constructor parameter; points to an instance of Redis running at localhost with its default port.



48
49
50
# File 'lib/ldclient-rb/redis_store.rb', line 48

def self.default_redis_url
  LaunchDarkly::Integrations::Redis::default_redis_url
end

Instance Method Details

#all(kind) ⇒ Object



63
64
65
# File 'lib/ldclient-rb/redis_store.rb', line 63

def all(kind)
  @wrapper.all(kind)
end

#delete(kind, key, version) ⇒ Object



67
68
69
# File 'lib/ldclient-rb/redis_store.rb', line 67

def delete(kind, key, version)
  @wrapper.delete(kind, key, version)
end

#get(kind, key) ⇒ Object



59
60
61
# File 'lib/ldclient-rb/redis_store.rb', line 59

def get(kind, key)
  @wrapper.get(kind, key)
end

#init(all_data) ⇒ Object



71
72
73
# File 'lib/ldclient-rb/redis_store.rb', line 71

def init(all_data)
  @wrapper.init(all_data)
end

#initialized?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/ldclient-rb/redis_store.rb', line 79

def initialized?
  @wrapper.initialized?
end

#stopObject



83
84
85
# File 'lib/ldclient-rb/redis_store.rb', line 83

def stop
  @wrapper.stop
end

#upsert(kind, item) ⇒ Object



75
76
77
# File 'lib/ldclient-rb/redis_store.rb', line 75

def upsert(kind, item)
  @wrapper.upsert(kind, item)
end