From 531177d42d3b34230fe4941b4c310e92e938bdc4 Mon Sep 17 00:00:00 2001
From: michael-grunder
Redis|array|false
bzPopMax(string|array $key, string|int $timeout_or_key, mixed ...$extra_args)
@@ -3835,7 +3835,18 @@ to Redis >= 6.0.0 to send a floating point timeout.
POP the maximum scoring element off of one or more sorted sets, blocking up to a specified -timeout if no elements are available.
+timeout if no elements are available.Following are examples of the two main ways to call this method.
+<?php
+// Method 1 - Variadic, with the last argument being our timeout
+$redis->bzPopMax('key1', 'key2', 'key3', 1.5);
+
+// Method 2 - A single array of keys, followed by the timeout
+$redis->bzPopMax(['key1', 'key2', 'key3'], 1.5);
+<?php>
+
+NOTE: We reccomend calling this function with an array and a timeout as the other strategy
+ may be deprecated in future versions of PhpRedis
+?>
Redis|array|false
bzPopMin(string|array $key, string|int $timeout_or_key, mixed ...$extra_args)
@@ -3975,7 +3973,7 @@ Redis::bzPopMax
Redis|array|null|false
bzmpop(float $timeout, array $keys, string $from, int $count = 1)
@@ -4038,7 +4036,7 @@ instead return NULL when Redis doesn't pop any elements.
Redis|array|null|false
zmpop(array $keys, string $from, int $count = 1)
@@ -4102,7 +4100,7 @@ pop the lowest or highest scoring elements.
Redis|array|null|false
blmpop(float $timeout, array $keys, string $from, int $count = 1)
@@ -4173,7 +4171,7 @@ were empty.
Redis|array|null|false
lmpop(array $keys, string $from, int $count = 1)
@@ -4238,7 +4236,7 @@ were empty.
bool
clearLastError()
@@ -4284,7 +4282,7 @@ var_dump($redis->getLastError());
mixed
client(string $opt, mixed ...$args)
@@ -4332,7 +4330,7 @@ var_dump($redis->getLastError());
bool
close()
@@ -4365,7 +4363,7 @@ var_dump($redis->getLastError());
mixed
command(string $opt = null, string|array $arg)
@@ -4413,7 +4411,7 @@ var_dump($redis->getLastError());
mixed
config(string $operation, array|string|null $key_or_settings = NULL, string|null $value = NULL)
@@ -4491,7 +4489,7 @@ $redis->config('SET', ['timeout' => 30, 'loglevel' => 'warning']);
bool
connect(string $host, int $port = 6379, float $timeout = 0, string $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, array $context = null)
@@ -4564,7 +4562,7 @@ $redis->config('SET', ['timeout' => 30, 'loglevel' => 'warning']);
Redis|bool
copy(string $src, string $dst, array $options = null)
@@ -4661,7 +4659,7 @@ var_dump($redis->copy('source1', 'exists', ['REPLACE' => true]));
Redis|int|false
dbSize()
@@ -4720,7 +4718,7 @@ var_dump($redis->dbsize());
Redis|string
debug(string $key)
@@ -4763,7 +4761,7 @@ var_dump($redis->dbsize());
Redis|int|false
decr(string $key, int $by = 1)
@@ -4842,7 +4840,7 @@ var_dump($redis->decr('counter', 2));
Redis|int|false
decrBy(string $key, int $value)
@@ -4911,7 +4909,7 @@ var_dump($redis->decrby('counter', 2));
Redis|int|false
del(array|string $key, string ...$other_keys)
@@ -4986,7 +4984,7 @@ var_dump($redis->del(['key:2', 'key:3', 'key:4']));
Redis|int|false
delete(array|string $key, string ...$other_keys)
deprecated
@@ -5041,7 +5039,7 @@ var_dump($redis->del(['key:2', 'key:3', 'key:4']));
Redis|bool
discard()
@@ -5088,7 +5086,7 @@ $redis->getMode();
Redis|string
dump(string $key)
@@ -5162,7 +5160,7 @@ $redis->zRange('new-zset', 0, -1, true);
Redis|string|false
echo(string $str)
@@ -5224,7 +5222,7 @@ var_dump($redis->echo('Hello, World'));
mixed
eval(string $script, array $args = [], int $num_keys = 0)
@@ -5290,7 +5288,7 @@ strings, arrays, nested arrays, etc.
mixed
eval_ro(string $script_sha, array $args = [], int $num_keys = 0)
@@ -5355,7 +5353,7 @@ Redis::eval
mixed
evalsha(string $sha1, array $args = [], int $num_keys = 0)
@@ -5426,7 +5424,7 @@ Redis::eval
mixed
evalsha_ro(string $sha1, array $args = [], int $num_keys = 0)
@@ -5491,7 +5489,7 @@ Redis::evalsha
Redis|array|false
exec()
@@ -5577,7 +5575,7 @@ Redis::multi
Redis|int|bool
exists(mixed $key, mixed ...$other_keys)
@@ -5653,7 +5651,7 @@ var_dump($redis->exists('k4', 'k5', 'notakey'));
Redis|bool
expire(string $key, int $timeout, string|null $mode = NULL)
@@ -5723,7 +5721,7 @@ GT - Set expiry only when new expiry is > current expiry
Redis|bool
expireAt(string $key, int $timestamp, string|null $mode = NULL)
@@ -5792,7 +5790,7 @@ Redis::expire
Redis|bool
failover(array|null $to = null, bool $abort = false, int $timeout = 0)
@@ -5845,7 +5843,7 @@ Redis::expire
Redis|int|false
expiretime(string $key)
@@ -5913,7 +5911,7 @@ var_dump($redis->expiretime('expiry-key'));
Redis|int|false
pexpiretime(string $key)
@@ -5974,7 +5972,7 @@ Redis::expiretime
Redis|bool
flushAll(bool|null $sync = null)
@@ -6020,7 +6018,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
Redis|bool
flushDB(bool|null $sync = null)
@@ -6066,7 +6064,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
Redis|int|false
geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)
@@ -6129,7 +6127,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
Redis|float|false
geodist(string $key, string $src, string $dst, string|null $unit = null)
@@ -6187,7 +6185,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
Redis|array|false
geohash(string $key, string $member, string ...$other_members)
@@ -6240,7 +6238,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
Redis|array|false
geopos(string $key, string $member, string ...$other_members)
@@ -6293,7 +6291,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
mixed
georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
@@ -6361,7 +6359,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
mixed
georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
@@ -6429,7 +6427,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
mixed
georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = [])
@@ -6492,7 +6490,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
mixed
georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = [])
@@ -6555,7 +6553,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
array
geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = [])
@@ -6618,7 +6616,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
Redis|array|int|false
geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = [])
@@ -6686,7 +6684,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
mixed
get(string $key)
@@ -6729,7 +6727,7 @@ on Redis' lazyfree-lazy-user-flush
config setting.
mixed
getAuth()
@@ -6773,7 +6771,7 @@ Redis::auth
Redis|int|false
getBit(string $key, int $idx)
@@ -6821,7 +6819,7 @@ Redis::auth
Redis|string|bool
getEx(string $key, array $options = [])
@@ -6869,7 +6867,7 @@ Redis::auth
int
getDBNum()
@@ -6902,7 +6900,7 @@ Redis::auth
Redis|string|bool
getDel(string $key)
@@ -6945,7 +6943,7 @@ Redis::auth
string
getHost()
@@ -6977,7 +6975,7 @@ Redis::auth
string|null
getLastError()
@@ -7009,7 +7007,7 @@ Redis::auth
int
getMode()
@@ -7041,7 +7039,7 @@ Redis::auth
mixed
getOption(int $option)
@@ -7095,7 +7093,7 @@ Redis::setOption
string|null
getPersistentID()
@@ -7127,7 +7125,7 @@ Redis::setOption
int
getPort()
@@ -7159,7 +7157,7 @@ Redis::setOption
Redis|string|false
getRange(string $key, int $start, int $end)
@@ -7224,7 +7222,7 @@ var_dump($redis->getRange('silly-word', -7, -1));
Redis|string|array|int|false
lcs(string $key1, string $key2, array|null $options = NULL)
@@ -7299,7 +7297,7 @@ var_dump($redis->lcs('seq1', 'seq2'));
float
getReadTimeout()
@@ -7331,7 +7329,7 @@ var_dump($redis->lcs('seq1', 'seq2'));
Redis|string|false
getset(string $key, mixed $value)
@@ -7389,7 +7387,7 @@ var_dump($redis->getset('captain', 'Kirk'));
float|false
getTimeout()
@@ -7421,7 +7419,7 @@ var_dump($redis->getset('captain', 'Kirk'));
int|false
getTransferredBytes()
@@ -7454,7 +7452,7 @@ var_dump($redis->getset('captain', 'Kirk'));
Redis|int|false
hDel(string $key, string $field, string ...$other_fields)
@@ -7527,7 +7525,7 @@ $redis->hDel('comms', 'Mallory', 'Archibald');
Redis|bool
hExists(string $key, string $field)
@@ -7598,7 +7596,7 @@ $redis->hExists('captains', 'Picard');
mixed
hGet(string $key, string $member)
@@ -7646,7 +7644,7 @@ $redis->hExists('captains', 'Picard');
Redis|array|false
hGetAll(string $key)
@@ -7716,7 +7714,7 @@ $redis->hGetAll('comms');
Redis|int|false
hIncrBy(string $key, string $field, int $value)
@@ -7792,7 +7790,7 @@ $redis->hIncrBy('player', 'level', 3);
Redis|float|false
hIncrByFloat(string $key, string $field, float $value)
@@ -7865,7 +7863,7 @@ $redis->hIncrByFloat('trig-numbers', 'tau', 2 * $pi);
Redis|array|false
hKeys(string $key)
@@ -7935,7 +7933,7 @@ $redis->hKeys('ships');
Redis|int|false
hLen(string $key)
@@ -7988,7 +7986,7 @@ $redis->hKeys('ships');
Redis|array|false
hMget(string $key, array $fields)
@@ -8061,7 +8059,7 @@ $redis->hmget('player:1', ['name', 'score']);
Redis|bool
hMset(string $key, array $fieldvals)
@@ -8124,7 +8122,7 @@ $redis->hmset('updates', ['status' => 'starting', 'elapsed' => 0]);
Redis|string|array
hRandField(string $key, array $options = null)
@@ -8197,7 +8195,7 @@ $redis->hrandfield('settings', ['count' => 2, 'withvalues' => true]);
Redis|int|false
hSet(string $key, string $member, mixed $value)
@@ -8250,7 +8248,7 @@ $redis->hrandfield('settings', ['count' => 2, 'withvalues' => true]);
Redis|bool
hSetNx(string $key, string $field, string $value)
@@ -8324,7 +8322,7 @@ var_dump($redis->hsetnx('player:1', 'lock', 'enabled'));
Redis|int|false
hStrLen(string $key, string $field)
@@ -8391,7 +8389,7 @@ $redis->hstrlen('hash', '50bytes');
Redis|array|false
hVals(string $key)
@@ -8459,7 +8457,7 @@ $redis->hgetall('player');
Redis|array|bool
hscan(string $key, int|null $iterator, string|null $pattern = null, int $count = 0)
@@ -8569,7 +8567,7 @@ do {
Redis|int|false
incr(string $key, int $by = 1)
@@ -8644,7 +8642,7 @@ $redis->incr('counter', 2);
Redis|int|false
incrBy(string $key, int $value)
@@ -8720,7 +8718,7 @@ $redis->incrby('primes', 4);
Redis|float|false
incrByFloat(string $key, float $value)
@@ -8778,7 +8776,7 @@ var_dump($redis->incrByFloat('tau', 3.1415926));
Redis|array|false
info(string ...$sections)
@@ -8834,7 +8832,7 @@ to that section. If connected to Redis server >=
bool
isConnected()
@@ -8866,7 +8864,7 @@ to that section. If connected to Redis server >=
Redis|array|false
keys(string $pattern)
@@ -8909,7 +8907,7 @@ to that section. If connected to Redis server >=
Redis|int|false
lInsert(string $key, string $pos, mixed $pivot, mixed $value)
@@ -8967,7 +8965,7 @@ to that section. If connected to Redis server >=
Redis|int|false
lLen(string $key)
@@ -9010,7 +9008,7 @@ to that section. If connected to Redis server >=
Redis|string|false
lMove(string $src, string $dst, string $wherefrom, string $whereto)
@@ -9068,7 +9066,7 @@ to that section. If connected to Redis server >=
Redis|bool|string|array
lPop(string $key, int $count = 0)
@@ -9116,7 +9114,7 @@ to that section. If connected to Redis server >=
Redis|null|bool|int|array
lPos(string $key, mixed $value, array $options = null)
@@ -9169,7 +9167,7 @@ to that section. If connected to Redis server >=
int|Redis
lPush(string $key, mixed ...$elements)
@@ -9217,7 +9215,7 @@ to that section. If connected to Redis server >=
Redis|int|false
rPush(string $key, mixed ...$elements)
@@ -9265,7 +9263,7 @@ to that section. If connected to Redis server >=
Redis|int|false
lPushx(string $key, mixed $value)
@@ -9313,7 +9311,7 @@ to that section. If connected to Redis server >=
Redis|int|false
rPushx(string $key, mixed $value)
@@ -9361,7 +9359,7 @@ to that section. If connected to Redis server >=
Redis|bool
lSet(string $key, int $index, mixed $value)
@@ -9414,7 +9412,7 @@ to that section. If connected to Redis server >=
int
lastSave()
@@ -9447,7 +9445,7 @@ to that section. If connected to Redis server >=
mixed
lindex(string $key, int $index)
@@ -9495,7 +9493,7 @@ to that section. If connected to Redis server >=
Redis|array|false
lrange(string $key, int $start, int $end)
@@ -9548,7 +9546,7 @@ to that section. If connected to Redis server >=
int|Redis|false
lrem(string $key, mixed $value, int $count = 0)
@@ -9601,7 +9599,7 @@ to that section. If connected to Redis server >=
Redis|bool
ltrim(string $key, int $start, int $end)
@@ -9654,7 +9652,7 @@ to that section. If connected to Redis server >=
array|Redis
mget(array $keys)
@@ -9697,7 +9695,7 @@ to that section. If connected to Redis server >=
Redis|bool
migrate(string $host, int $port, string|array $key, int $dstdb, int $timeout, bool $copy = false, bool $replace = false, mixed $credentials = NULL)
@@ -9775,7 +9773,7 @@ to that section. If connected to Redis server >=
bool
move(string $key, int $index)
@@ -9823,7 +9821,7 @@ to that section. If connected to Redis server >=
Redis|bool
mset(array $key_values)
@@ -9866,7 +9864,7 @@ to that section. If connected to Redis server >=
Redis|bool
msetnx(array $key_values)
@@ -9909,7 +9907,7 @@ to that section. If connected to Redis server >=
bool|Redis
multi(int $value = Redis::MULTI)
@@ -9952,7 +9950,7 @@ to that section. If connected to Redis server >=
Redis|int|string|false
object(string $subcommand, string $key)
@@ -10000,7 +9998,7 @@ to that section. If connected to Redis server >=
bool
open(string $host, int $port = 6379, float $timeout = 0, string $persistent_id = NULL, int $retry_interval = 0, float $read_timeout = 0, array $context = NULL)
deprecated
@@ -10080,7 +10078,7 @@ to that section. If connected to Redis server >=
bool
pconnect(string $host, int $port = 6379, float $timeout = 0, string $persistent_id = NULL, int $retry_interval = 0, float $read_timeout = 0, array $context = NULL)
@@ -10153,7 +10151,7 @@ to that section. If connected to Redis server >=
bool
persist(string $key)
@@ -10196,7 +10194,7 @@ to that section. If connected to Redis server >=
bool
pexpire(string $key, int $timeout, string|null $mode = NULL)
@@ -10252,7 +10250,7 @@ command works.
Redis|bool
pexpireAt(string $key, int $timestamp, string|null $mode = NULL)
@@ -10323,7 +10321,7 @@ Redis::expire
Redis|int
pfadd(string $key, array $elements)
@@ -10381,7 +10379,7 @@ Redis::expire
Redis|int
pfcount(string $key)
@@ -10434,7 +10432,7 @@ Redis::expire
Redis|bool
pfmerge(string $dst, array $srckeys)
@@ -10492,7 +10490,7 @@ Redis::expire
Redis|string|bool
ping(string $message = NULL)
@@ -10555,7 +10553,7 @@ $redis->ping('beep boop');
bool|Redis
pipeline()
@@ -10607,7 +10605,7 @@ $redis->pipeline()
bool
popen(string $host, int $port = 6379, float $timeout = 0, string $persistent_id = NULL, int $retry_interval = 0, float $read_timeout = 0, array $context = NULL)
deprecated
@@ -10687,7 +10685,7 @@ $redis->pipeline()
bool|Redis
psetex(string $key, int $expire, mixed $value)
@@ -10740,7 +10738,7 @@ $redis->pipeline()
bool
psubscribe(array $patterns, callable $cb)
@@ -10799,7 +10797,7 @@ $redis->pipeline()
Redis|int|false
pttl(string $key)
@@ -10862,7 +10860,7 @@ var_dump($redis->pttl('ttl-key'));
Redis|int|false
publish(string $channel, string $message)
@@ -10920,7 +10918,7 @@ var_dump($redis->pttl('ttl-key'));
mixed
pubsub(string $command, mixed $arg = null)
@@ -10968,7 +10966,7 @@ var_dump($redis->pttl('ttl-key'));
Redis|array|bool
punsubscribe(array $patterns)
@@ -11034,7 +11032,7 @@ Redis::subscribe
Redis|array|string|bool
rPop(string $key, int $count = 0)
@@ -11109,7 +11107,7 @@ $redis->rPop('mylist');
Redis|string|false
randomKey()
@@ -11152,7 +11150,7 @@ $redis->rPop('mylist');
mixed
rawcommand(string $command, mixed ...$args)
@@ -11220,7 +11218,7 @@ $redis->rawCommand('lrange', 'mylist', 0, -1);
Redis|bool
rename(string $old_name, string $new_name)
@@ -11278,7 +11276,7 @@ $redis->rawCommand('lrange', 'mylist', 0, -1);
Redis|bool
renameNx(string $key_src, string $key_dst)
@@ -11350,7 +11348,7 @@ $redis->renamenx('dst', 'existing-dst');
Redis|bool
reset()
@@ -11382,7 +11380,7 @@ $redis->renamenx('dst', 'existing-dst');
Redis|bool
restore(string $key, int $ttl, string $value, array|null $options = NULL)
@@ -11502,7 +11500,7 @@ Redis::dump
mixed
role()
@@ -11535,7 +11533,7 @@ an error.
Redis|string|false
rpoplpush(string $srckey, string $dstkey)
@@ -11618,7 +11616,7 @@ var_dump($redis->lrange('list1', 0, -1));
Redis|int|false
sAdd(string $key, mixed $value, mixed ...$other_values)
@@ -11693,7 +11691,7 @@ var_dump($redis->sadd('myset', 'foo', 'new'));
int
sAddArray(string $key, array $values)
@@ -11770,7 +11768,7 @@ var_dump($redis->sAddArray('myset', ['foo', 'new']));
Redis|array|false
sDiff(string $key, string ...$other_keys)
@@ -11852,7 +11850,7 @@ array(2) {
Redis|int|false
sDiffStore(string $dst, string $key, string ...$other_keys)
@@ -11922,7 +11920,7 @@ values in a specified destination key.
Redis|array|false
sInter(array|string $key, string ...$other_keys)
@@ -12001,7 +11999,7 @@ var_dump($redis->sinter('alice_likes', 'bob_likes', 'bill_likes'));
Redis|int|false
sintercard(array $keys, int $limit = -1)
@@ -12072,7 +12070,7 @@ var_dump($redis->sInterCard(['set1', 'set2', 'set3']));
Redis|int|false
sInterStore(array|string $key, string ...$other_keys)
@@ -12147,7 +12145,7 @@ $redis->sInterStore('dst', 'src1', 'src'2', 'src3');
Redis|array|false
sMembers(string $key)
@@ -12218,7 +12216,7 @@ $redis->sMembers('tng-crew');
Redis|array|false
sMisMember(string $key, string $member, string ...$other_members)
@@ -12315,7 +12313,7 @@ var_dump(array_combine($names, $members));
Redis|bool
sMove(string $src, string $dst, mixed $value)
@@ -12408,7 +12406,7 @@ var_dump($redis->sMembers('evens'));
Redis|string|array|false
sPop(string $key, int $count = 0)
@@ -12499,7 +12497,7 @@ var_dump($redis->sMembers('evens'));
Redis|string|array|false
sRandMember(string $key, int $count = 0)
@@ -12567,7 +12565,7 @@ $rng3 = $redis->sRandMember('elder-gods', -9999);
Redis|array|false
sUnion(string $key, string ...$other_keys)
@@ -12650,7 +12648,7 @@ var_dump($redis->sunion('set1', 'set2', 'set3'));
Redis|int|false
sUnionStore(string $dst, string $key, string ...$other_keys)
@@ -12720,7 +12718,7 @@ false on failure.
Redis|bool
save()
@@ -12770,7 +12768,7 @@ completed. For a nonblocking alternative, see Redis::bgsave().
array|false
scan(int|null $iterator, string|null $pattern = null, int $count = 0, string $type = NULL)
@@ -12780,7 +12778,38 @@ completed. For a nonblocking alternative, see Redis::bgsave().
Incrementally scan the Redis keyspace, with optional pattern and type matching.
+Incrementally scan the Redis keyspace, with optional pattern and type matching.
A note about Redis::SCAN_NORETRY and Redis::SCAN_RETRY.
+For convenience, PhpRedis can retry SCAN commands itself when Redis returns an empty array of +keys with a nonzero iterator. This can happen when matching against a pattern that very few +keys match inside a key space with a great many keys. The following example demonstrates how +to use Redis::scan() with the option disabled and enabled.
+<?php
+
+$redis = new Redis(['host' => 'localhost']);
+
+$redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY);
+
+$it = NULL;
+
+do {
+ $keys = $redis->scan($it, '*zorg*');
+ foreach ($keys as $key) {
+ echo "KEY: $key\n";
+ }
+} while ($it != 0);
+
+$redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
+
+$it = NULL;
+
+// When Redis::SCAN_RETRY is enabled, we can use simpler logic, as we will never receive an
+// empty array of keys when the iterator is nonzero.
+while ($keys = $redis->scan($it, '*zorg*')) {
+ foreach ($keys as $key) {
+ echo "KEY: $key\n";
+ }
+}
+?>
Redis|int|false
scard(string $key)
@@ -12952,7 +12949,7 @@ $redis->scard('set');
mixed
script(string $command, mixed ...$args)
@@ -13029,7 +13026,7 @@ var_dump($redis->script('exists', sha1($lua)));
Redis|bool
select(int $db)
@@ -13087,7 +13084,7 @@ var_dump($redis->exists('this_is_db_1'));
Redis|string|bool
set(string $key, mixed $value, mixed $options = NULL)
@@ -13181,7 +13178,7 @@ $redis->set('key', 'options_set', ['XX']);
Redis|int|false
setBit(string $key, int $idx, bool $value)
@@ -13255,7 +13252,7 @@ $redis->get('foo');
Redis|int|false
setRange(string $key, int $index, string $value)
@@ -13326,7 +13323,7 @@ $redis->setRange('message', 6, 'Redis');
bool
setOption(int $option, mixed $value)
@@ -13336,7 +13333,83 @@ $redis->setRange('message', 6, 'Redis');
Set a configurable option on the Redis object.
+Set a configurable option on the Redis object.
Following are a list of options you can set:
+OPTION | +TYPE | +DESCRIPTION | +
---|---|---|
OPT_MAX_RETRIES | +int | +The maximum number of times Redis will attempt to reconnect if it gets disconnected, before throwing an exception. | +
OPT_SCAN | +enum | +Redis::OPT_SCAN_RETRY, or Redis::OPT_SCAN_NORETRY. Whether PhpRedis should automatically SCAN again when zero keys but a nonzero iterator are returned. | +
OPT_SERIALIZER | +enum | +Set the automatic data serializer.Redis::SERIALIZER_NONE Redis::SERIALIZER_PHP Redis::SERIALIZER_IGBINARY Redis::SERIALIZER_MSGPACK , Redis::SERIALIZER_JSON |
+
OPT_PREFIX | +string | +A string PhpRedis will use to prefix every key we read or write. | +
OPT_READ_TIMEOUT | +float | +How long PhpRedis will block for a response from Redis before throwing a 'read error on connection' exception. | +
OPT_TCP_KEEPALIVE | +bool | +Set or disable TCP_KEEPALIVE on the connection. | +
OPT_COMPRESSION | +enum | +Set the compression algorithmRedis::COMPRESSION_NONE Redis::COMPRESSION_LZF Redis::COMPRESSION_LZ4 Redis::COMPRESSION_ZSTD |
+
OPT_REPLY_LITERAL | +bool | +If set to true, PhpRedis will return the literal string Redis returns for LINE replies (e.g. '+OK'), rather than true . |
+
OPT_COMPRESSION_LEVEL | +int | +Set a specific compression level if Redis is compressing data. | +
OPT_NULL_MULTIBULK_AS_NULL | +bool | +Causes PhpRedis to return NULL rather than false for NULL MULTIBULK replies |
+
OPT_BACKOFF_ALGORITHM | +enum | +The exponential backoff strategy to use. | +
OPT_BACKOFF_BASE | +int | +The minimum delay between retries when backing off. | +
OPT_BACKOFF_CAP | +int | +The maximum delay between replies when backing off. | +