22
33namespace LaunchDarkly \Integrations ;
44
5- use LaunchDarkly \Impl \Integrations \RedisFeatureRequester ;
65use LaunchDarkly \Impl \Integrations \RedisBigSegmentsStore ;
6+ use LaunchDarkly \Impl \Integrations \RedisFeatureRequester ;
77use LaunchDarkly \Subsystems ;
88use Predis \ClientInterface ;
99use Psr \Log \LoggerInterface ;
@@ -20,39 +20,29 @@ class Redis
2020 *
2121 * After calling this method, store its return value in the `feature_requester` property of your client configuration:
2222 *
23- * $fr = LaunchDarkly\Integrations\Redis::featureRequester([ "redis_prefix " => "env1" ]);
24- * $config = [ "feature_requester" => $fr ];
23+ * $fr = LaunchDarkly\Integrations\Redis::featureRequester(["prefix " => "env1"]);
24+ * $config = ["feature_requester" => $fr];
2525 * $client = new LDClient("sdk_key", $config);
2626 *
2727 * For more about using LaunchDarkly with databases, see the
2828 * [SDK reference guide](https://docs.launchdarkly.com/sdk/features/storing-data).
2929 *
30- * @param array $options Configuration settings (can also be passed in the main client configuration):
31- * - `redis_host`: hostname of the Redis server; defaults to `localhost`
32- * - `redis_port`: port of the Redis server; defaults to 6379
33- * - `redis_timeout`: connection timeout in seconds; defaults to 5
34- * - `redis_prefix`: a string to be prepended to all database keys; corresponds to the prefix
35- * setting in ld-relay
36- * - `predis_client`: an already-configured Predis client instance if you wish to reuse one; if
37- * specified, this will cause all other options except `redis_prefix` and `apc_expiration`
38- * to be ignored
39- * - `predis_options`: an array of connection options to be passed directly to the Predis client;
40- * these can include any options supported by `Predis\Client`, and will override any equivalent
41- * top-level options (for instance, `"host"` in `predis_options` takes priority over `"redis_host"`
42- * at the top level)
43- * - `apc_expiration`: expiration time in seconds for local caching, if `APCu` is installed
44- * @return mixed an object to be stored in the `feature_requester` configuration property
30+ * @param array<string, mixed> $options Configuration settings (can also be passed in the main client configuration):
31+ * - `prefix`: a string to be prepended to all database keys; corresponds
32+ * to the prefix setting in ld-relay
33+ * @return callable(string, string, array): Subsystems\FeatureRequester
4534 */
46- public static function featureRequester (array $ options = [])
35+ public static function featureRequester (ClientInterface $ client , array $ options = []): callable
4736 {
48- return function (string $ baseUri , string $ sdkKey , array $ baseOptions ) use ($ options ) {
49- return new RedisFeatureRequester ($ baseUri , $ sdkKey , array_merge ($ baseOptions , $ options ));
37+ return function (string $ baseUri , string $ sdkKey , array $ baseOptions ) use ($ client , $ options ): Subsystems \ FeatureRequester {
38+ return new RedisFeatureRequester ($ client , $ baseUri , $ sdkKey , array_merge ($ baseOptions , $ options ));
5039 };
5140 }
5241
5342 /**
5443 * @param array<string,mixed> $options
55- * - `prefix`: namespace prefix to add to all hash keys
44+ * - `prefix`: a string to be prepended to all database keys; corresponds
45+ * to the prefix setting in ld-relay
5646 * @return callable(LoggerInterface, array): Subsystems\BigSegmentsStore
5747 */
5848 public static function bigSegmentsStore (ClientInterface $ client , array $ options = []): callable
0 commit comments