44
55use LaunchDarkly \Impl \Integrations ;
66use LaunchDarkly \Subsystems ;
7+ use LaunchDarkly \Subsystems \FeatureRequester ;
78use Psr \Log \LoggerInterface ;
89use Redis ;
910
@@ -28,40 +29,33 @@ class PHPRedis
2829 * [SDK reference guide](https://docs.launchdarkly.com/sdk/features/storing-data).
2930 *
3031 * @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_password`: password to auth against the Redis server; optional
34- * - `redis_timeout`: connection timeout in seconds; defaults to 5
35- * - `redis_prefix`: a string to be prepended to all database keys; corresponds to the prefix
36- * setting in ld-relay
37- * - `phpredis_client`: an already-configured Redis client instance if you wish to reuse one
32+ * - `prefix`: a string to be prepended to all database keys; corresponds
33+ * to the prefix setting in ld-relay
3834 * - `apc_expiration`: expiration time in seconds for local caching, if `APCu` is installed
39- * @return mixed an object to be stored in the `feature_requester` configuration property
35+ * @return callable(string, string, array): FeatureRequester an object to be stored in the `feature_requester` configuration property
4036 */
41- public static function featureRequester ($ options = [])
37+ public static function featureRequester (Redis $ client , $ options = []): callable
4238 {
4339 if (!extension_loaded ('redis ' )) {
4440 throw new \RuntimeException ("phpredis extension is required to use Integrations \\PHPRedis " );
4541 }
4642
47- return function (string $ baseUri , string $ sdkKey , array $ baseOptions ) use ($ options ) {
48- return new Integrations \PHPRedisFeatureRequester ($ baseUri , $ sdkKey , array_merge ($ baseOptions , $ options ));
43+ return function (string $ baseUri , string $ sdkKey , array $ baseOptions ) use ($ client , $ options ): FeatureRequester {
44+ return new Integrations \PHPRedisFeatureRequester ($ client , $ baseUri , $ sdkKey , array_merge ($ baseOptions , $ options ));
4945 };
5046 }
5147
5248 /**
5349 * @param array<string,mixed> $options
54- * - `prefix`: namespace prefix to add to all hash keys
55- * @return callable(LoggerInterface, array): Subsystems\BigSegmentsStore
50+ * - `prefix`: a string to be prepended to all database keys; corresponds
51+ * to the prefix setting in ld-relay
5652 */
57- public static function bigSegmentsStore (Redis $ client , array $ options = []): callable
53+ public static function bigSegmentsStore (Redis $ client , LoggerInterface $ logger , array $ options = []): Subsystems \ BigSegmentsStore
5854 {
5955 if (!extension_loaded ('redis ' )) {
6056 throw new \RuntimeException ("phpredis extension is required to use Integrations \\PHPRedis " );
6157 }
6258
63- return function (LoggerInterface $ logger , array $ baseOptions ) use ($ client , $ options ): Subsystems \BigSegmentsStore {
64- return new Integrations \PHPRedisBigSegmentsStore ($ client , $ logger , array_merge ($ baseOptions , $ options ));
65- };
59+ return new Integrations \PHPRedisBigSegmentsStore ($ client , $ logger , $ options );
6660 }
6761}
0 commit comments