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

  • :pool_shutdown_on_close (Boolean)

    whether calling close should shutdown the custom connection pool.



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

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.



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

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.



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

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

Instance Method Details

#all(kind) ⇒ Object



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

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

#delete(kind, key, version) ⇒ Object



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

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

#get(kind, key) ⇒ Object



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

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

#init(all_data) ⇒ Object



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

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

#initialized?Boolean

Returns:

  • (Boolean)


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

def initialized?
  @wrapper.initialized?
end

#stopObject



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

def stop
  @wrapper.stop
end

#upsert(kind, item) ⇒ Object



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

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