class LaunchDarkly::RedisFeatureStore
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.
@deprecated Use the factory method in {LaunchDarkly::Integrations::Redis} instead. This specific
implementation class may be changed or removed in the future.
Public Class Methods
Default value for the `prefix` constructor parameter.
# File lib/ldclient-rb/redis_store.rb, line 56 def self.default_prefix LaunchDarkly::Integrations::Redis::default_prefix end
Default value for the `redis_url` constructor parameter; points to an instance of Redis running at `localhost` with its default port.
# File lib/ldclient-rb/redis_store.rb, line 49 def self.default_redis_url LaunchDarkly::Integrations::Redis::default_redis_url end
Constructor for a RedisFeatureStore
instance.
@param opts [Hash] the configuration options @option opts [String] :redis_url URL of the Redis instance (shortcut for omitting redis_opts) @option opts [Hash] :redis_opts options to pass to the Redis constructor (if you want to specify more than just redis_url) @option opts [String] :prefix namespace prefix to add to all hash keys used by LaunchDarkly
@option opts [Logger] :logger a `Logger` instance; defaults to `Config.default_logger` @option opts [Integer] :max_connections size of the Redis connection pool @option opts [Integer] :expiration expiration time for the in-memory cache, in seconds; 0 for no local caching @option opts [Integer] :capacity maximum number of feature flags (or related objects) to cache locally @option opts [Object] :pool custom connection pool, if desired @option opts [Boolean] :pool_shutdown_on_close whether calling `close` should shutdown the custom connection pool.
# 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
Public Instance Methods
# File lib/ldclient-rb/redis_store.rb, line 64 def all(kind) @wrapper.all(kind) end
# File lib/ldclient-rb/redis_store.rb, line 68 def delete(kind, key, version) @wrapper.delete(kind, key, version) end
# File lib/ldclient-rb/redis_store.rb, line 60 def get(kind, key) @wrapper.get(kind, key) end
# File lib/ldclient-rb/redis_store.rb, line 72 def init(all_data) @wrapper.init(all_data) end
# File lib/ldclient-rb/redis_store.rb, line 80 def initialized? @wrapper.initialized? end
# File lib/ldclient-rb/redis_store.rb, line 84 def stop @wrapper.stop end
# File lib/ldclient-rb/redis_store.rb, line 76 def upsert(kind, item) @wrapper.upsert(kind, item) end