4
4
5
5
use LaunchDarkly \Impl \Integrations ;
6
6
use LaunchDarkly \Subsystems ;
7
+ use LaunchDarkly \Subsystems \FeatureRequester ;
7
8
use Psr \Log \LoggerInterface ;
8
9
use Redis ;
9
10
@@ -28,40 +29,33 @@ class PHPRedis
28
29
* [SDK reference guide](https://docs.launchdarkly.com/sdk/features/storing-data).
29
30
*
30
31
* @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
38
34
* - `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
40
36
*/
41
- public static function featureRequester ($ options = [])
37
+ public static function featureRequester (Redis $ client , $ options = []): callable
42
38
{
43
39
if (!extension_loaded ('redis ' )) {
44
40
throw new \RuntimeException ("phpredis extension is required to use Integrations \\PHPRedis " );
45
41
}
46
42
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 ));
49
45
};
50
46
}
51
47
52
48
/**
53
49
* @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
56
52
*/
57
- public static function bigSegmentsStore (Redis $ client , array $ options = []): callable
53
+ public static function bigSegmentsStore (Redis $ client , LoggerInterface $ logger , array $ options = []): Subsystems \ BigSegmentsStore
58
54
{
59
55
if (!extension_loaded ('redis ' )) {
60
56
throw new \RuntimeException ("phpredis extension is required to use Integrations \\PHPRedis " );
61
57
}
62
58
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 );
66
60
}
67
61
}
0 commit comments