This relates to a previous hotfix for issue #379 where phpredis
would time out if you sent an array of empty values. The reason
it was timing out is that the argument count being sent wasn't
reflecting any skipped items in the array (meaning redis was
waiting for the rest of the command).
I realized that the previous fix would still fail if you were to
send some valid values, with invalid (null, empty string, etc)
ones mixed in.
Presently, we're just skipping invalid items in the array but there
might be a case to issue a php_error_docref type warning when we
encounter them, so the user can know that it happened.
In addition, HMGET now uses a smart_str to build the command, which
means the time it takes to build the key will scale in a linear fashion
Use the lengths for our optional parameters, as NULL will
come through as a non null zval pointer with a zero length
Properly return the length from the redis_cmd_sstr_init function
This commit changes how we build the Redis protocol string for
ZUNIONSTORE and ZINTERSTORE such that we avoid reallocating
memory for the command buffer for each new key or weight
This commit changes the way we construct the MGET command
such that we avoid allocating and reallocating the command
string pointer for every new key that is added.
This means that MGET performance scales in a linear way rather
than exponentially.
Implement the new SET options as per the redis documentation:
http://redis.io/commands/set
You can now pass the new options (ex=>sec, px=>milisec, xx, nx) as
an array of options to the SET command and phpredis will handle them.
If you pass key, value, <long> phpredis will still redirect to SETEX
as it did before (to avoid breaking implementations).
Addresses #364
When Redis::(p)connect() is called on a newly created Redis instance that will always cause an exception to be thrown. The connect code will actually try and cancel the
exception but this is problematic when you are using tools like APM (pecl.php.net/apm) which hook into the exception handler: it will already have handled it. This change simply stops the connect from throwing exceptions for that situation.
This commit adds methods to get information about the state
of our phpredis object, such as what host/port we are connected
to, our timeout, etc...
The following methods have been added:
getHost()
getPort()
getDBNum()
getTimeout()
getReadTimeout()
isConnected()
getPersistentID()
getAuth()
In addition, there is a small memory leak fix when a persistent id
was specifically passed to connect() (it wasn't beeing freed).
Addresses issue #320
Added an option to let each RedisArray connection connect lazily to
their respective server. This is useful then working with a redis
cluster composed of many shards which are not necessarily in use all at
once.
New select DB command to RedisArray - Added retry delay on reconnect
Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
Also, fixed a compiler warning:
redis_array_impl.c:1115:15: warning: incompatible pointer types
assigning to 'zval **' (aka 'struct _zval_struct **') from 'zval
**(*)[2]' [-Wincompatible-pointer-types]
Conflicts:
common.h
This commit adds support for the CLIENT commands (list, getname,
setname, kill).
You can call them like so:
$redis->client('list');
$redis->client('getname');
$redis->client('setname', $name);
$redis->client('kill', $ip_port);
Solves issue #300
Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
Also, fixed a compiler warning:
redis_array_impl.c:1115:15: warning: incompatible pointer types
assigning to 'zval **' (aka 'struct _zval_struct **') from 'zval
**(*)[2]' [-Wincompatible-pointer-types]
Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
continue to destroy and reallocate the command buffer
Added a simply library routine to append to a command buffer
using a smart_str
Made the unit tests work even if you're not compiled with
igbinary
Addresses issue #287
Adds support for the new COUNT argument to SRANDMEMBER. If called
without a count, we will still return a string response (with one
randome member from the set, or false on a failure/type error).
If the count argument is passed, we return instead an array up to
the number asked for, given how Redis will process this value.
http://redis.io/commands/srandmember
When arguments were passed in the form ($key1, $key2, ...) to BLPOP
or BRPOP with a prefix, the timeout value was also being prefixed
causing it to misbehave.
Now for these commands we ignore the prefix on our timeout argument
Fixes issue #158