@@ -132,7 +132,7 @@ Listing all available commands is out of scope here, please refer to the
132
132
133
133
Any arguments passed to the method call will be forwarded as command arguments.
134
134
For example, the ` $redis->set('name', 'Alice') ` call will perform the equivalent of a
135
- ` SET name Alice ` command. It's safe to pass integer arguments where applicable (for
135
+ ` SET name Alice ` command. It's safe to pass numeric arguments where applicable (for
136
136
example ` $redis->expire($key, 60) ` ), but internally Redis requires all arguments to
137
137
always be coerced to string values.
138
138
@@ -417,7 +417,7 @@ $redis = new Clue\React\Redis\RedisClient('localhost', $connector);
417
417
418
418
#### __ call()
419
419
420
- The ` __call(string $name, string[] $args): PromiseInterface<mixed> ` method can be used to
420
+ The ` __call(string $name, list< string|int|float> $args): PromiseInterface<mixed> ` method can be used to
421
421
invoke the given command.
422
422
423
423
This is a magic method that will be invoked when calling any Redis command on this instance.
@@ -441,7 +441,7 @@ Listing all available commands is out of scope here, please refer to the
441
441
442
442
Any arguments passed to the method call will be forwarded as command arguments.
443
443
For example, the ` $redis->set('name', 'Alice') ` call will perform the equivalent of a
444
- ` SET name Alice ` command. It's safe to pass integer arguments where applicable (for
444
+ ` SET name Alice ` command. It's safe to pass numeric arguments where applicable (for
445
445
example ` $redis->expire($key, 60) ` ), but internally Redis requires all arguments to
446
446
always be coerced to string values.
447
447
@@ -451,9 +451,12 @@ that eventually *fulfills* with its *results* on success or *rejects* with an
451
451
452
452
#### callAsync()
453
453
454
- The ` callAsync(string $command, string ...$args): PromiseInterface<mixed> ` method can be used to
454
+ The ` callAsync(string $command, string|int|float ...$args): PromiseInterface<mixed> ` method can be used to
455
455
invoke a Redis command.
456
456
457
+ For example, the [ ` GET ` command] ( https://redis.io/commands/get ) can be invoked
458
+ like this:
459
+
457
460
``` php
458
461
$redis->callAsync('GET', 'name')->then(function (?string $name): void {
459
462
echo 'Name: ' . ($name ?? 'Unknown') . PHP_EOL;
@@ -470,12 +473,10 @@ may understand this magic method. Listing all available commands is out
470
473
of scope here, please refer to the
471
474
[ Redis command reference] ( https://redis.io/commands ) .
472
475
473
- The optional ` string ...$args ` parameter can be used to pass any
474
- additional arguments to the Redis command. Some commands may require or
475
- support additional arguments that this method will simply forward as is.
476
- Internally, Redis requires all arguments to be coerced to ` string ` values,
477
- but you may also rely on PHP's type-juggling semantics and pass ` int ` or
478
- ` float ` values:
476
+ The optional ` string|int|float ...$args ` parameter can be used to pass
477
+ any additional arguments that some Redis commands may require or support.
478
+ Values get passed directly to Redis, with any numeric values converted
479
+ automatically since Redis only works with ` string ` arguments internally:
479
480
480
481
``` php
481
482
$redis->callAsync('SET', 'name', 'Alice', 'EX', 600);
0 commit comments