All Versions
42
Latest Version
Avg Release Cycle
167 days
Latest Release
555 days ago

Changelog History
Page 2

  • v1.1.5 Changes

    September 10, 2020

    ๐Ÿš€ Here we have a new patch release!

    NOTE: We are still missing handlers for commands added in Redis 4, 5 and 6. We will get on par eventually, in the meanwhile you can define your own ones or use Predis\Client::executeRaw(). Read this post for details about how to properly implement support for new commands if you would like to add missing ones and share your work with us by creating pull requests, contributions are always greatly appreciated!

    ๐Ÿš€ NOTE intentionally commented out, please read the release notes for v1.1.6
    ๐Ÿ›  FIX : authentication for sentinels is now supported, previously it was not possible to specify a password for sentinels as its value was stripped during initialization because sentinels did not support authentication until Redis 5. Please note that with the current implementation each sentinel must have its own password parameter set in the parameters list despite this password is the same for all sentinels (read how requirepass works on the Redis docs). In this case you should avoid using the global parameters client option used to set default parameters for every connection created by Predis as this would end up using the same password even when connecting to actual Redis nodes. We are investiganting how to make it easier to specify the required password to access sentinels only once instead of repeating it for each sentinel.

    ๐Ÿ›  FIX : the username is now correctly retrieved from the userinfo fragment of the URI when using the redis scheme and a username:password pair is present. Values retrieved from the userinfo fragment always override the ones specified in username and password if those fields are present in the query string.

    ๐Ÿ›  FIX : Predis\Connection\WebdisConnection was unable to connect to Webdis when using an IPv4 address in the URL and this is probably due to some change in cURL internals since the last time we tested it.

    ๐Ÿ›  FIX : an exception is thrown when passing FALSE or any value evaluating to FALSE to the replication client option. This was supposed to be unsupported, in fact it actually breaks client initialization and raises a PHP warning. Now the user is alerted with an InvalidArgumentException and a proper message. (PR #381).

  • v1.1.4 Changes

    August 31, 2020

    ๐Ÿš€ Here is a new patch release for v1.1 with more improvements and fixes.

    NOTE: We are still missing handlers for commands added in Redis 4, 5 and 6. We will get on par eventually, in the meanwhile you can define your own ones or use Predis\Client::executeRaw(). Read this post for details about how to properly implement support for new commands if you would like to add missing ones and share your work with us by creating pull requests, contributions are always greatly appreciated!

    The client can now handle ACL authentication when connecting to Redis 6 , just pass both username and password to connection parameters and Predis switches to using the augmented variant of AUTH:

    // When using an URI string for parameters:$client = new Predis\Client('tcp://127.0.0.1?username=myuser&password=mypassword');// When using a named array for parameters:$client = new Predis\Client(['username' =\> 'myuser', 'password' =\> 'mypassword',]);
    

    ๐Ÿ“š As usual Redis servers protected only by a password can still be accessed with just the password parameter. See the Redis documentation for more details about Redis ACLs.

    ๐Ÿ›  FIX : NULL or zero-length string values in password and database do not trigger spurious AUTH and SELECT commands anymore when connecting to Redis.

    // Won't trigger `AUTH` and `SELECT`:$client = new Predis\Client('tcp://127.0.0.1?password=&database=');// Won't trigger `AUTH` and `SELECT`:$client = new Predis\Client(['password' =\> null, 'database' =\> '',]);
    

    ๐Ÿ‘€ This fix addresses some old issues with certain libraries and frameworks (see ISSUE #436).

    ๐Ÿš€ Empty connection parameters do not make much sense anyway so, in the next major release , any field containing NULL or a zero-length string will be stripped away when converting URI strings and named arrays to instances of Predis\Connection\Parameters.

    ๐Ÿ›  FIX : SORT now always triggers a switch to the master node in replication configurations instead of just when the STORE modifier is specified. The reason for this change is that SORT is always considered to be a write operation and it actually fails with a -READONLY error response when executed against a replica node (ISSUE #554).

    ๐Ÿ›  FIX : using foreach() on a client instance when it is connected to a single Redis server does not throw an exception anymore but the iteration will run for just one loop returning a new client for the underlying single-node connection (ISSUE #552, PR #556).

    $client = new Predis\Client('tcp://127.0.0.1');foreach ($client as $clientNode) { // Iterates just once, does not throw an exception anymore.}
    

    ๐Ÿ‘ป Using foreach() actually makes sense when using aggregate connection backends for client-side sharding or redis-cluster but there is no reason (and it is wrong anyway) to throw an exception in Predis\Client::getIterator() when the client is connected to a single server.

    ๐Ÿ›  FIX : Predis\Cluster\Distributor\HashRingaddNodeToRing was calculating the hash required for distribution by using crc32() directly instead of the method Predis\Cluster\Hash\HashGeneratorInterface::hash() implemented by the class itself. This fix does not have any impact on existing cluster deployments using client-side sharding based on this distributor simply because it does not take any external hash generators so distribution is not going to be affected.

    ๐Ÿ‘Œ Improved @method annotations for methods responding to Redis commands defined by Predis\ClientInterface and Predis\ClientContextInterface (PR #456 and PR #497, other fixes applied after further analysys).

  • v1.1.3 Changes

    August 18, 2020
    • Ensure compatibility with PHP 8.

    • ๐Ÿšš Moved repository from github.com/nrk/predis to github.com/predis/predis.

    • ๐Ÿ›  FIX: Moved cweagans/composer-patches dependency to require-dev.

    • ๐Ÿ›  FIX: Include PHPUnit .patch files in exports.

  • v1.1.2 Changes

    August 11, 2020

    ๐Ÿฑ Predis is under new management. Read the announcement and checkout the roadmap ๐Ÿš€

    ๐Ÿ‘ If you (or your business) would like to support the development of this fantastic library and ensure it's bright future, please use the GitHub Sponsor button ๐Ÿ™๐Ÿป

    ๐Ÿ”„ Changes

    ๐Ÿ›  FIX : pure CRC16 implementation failed to calculate the correct hash when
    the input value passed to the hash() method is an integer (PR #450).

    ๐Ÿ›  FIX : make PHP iterator abstractions for ZSCAN and HSCAN working with
    PHP 7.2 due to a breaking change, namely the removal of each() (PR #448).

  • v1.1.1 Changes

    June 17, 2016

    ๐Ÿš€ This is a patch release of Predis v1.1 that fixes a few bugs affecting the previous release. As usual you can read the CHANGELOG for a schematic list of the changes.

    ๐Ÿ› Bug fixes

    • ๐Ÿ›  FIX : password and database from the global parameters client option were still being applied to sentinels connections making them fail (sentinels do not understand the AUTH and SELECT commands) (PR #346).
    • ๐Ÿ›  FIX : when a sentinel instance reports no slave for a service, invoking connect() on the redis-sentinel connection backend should fall back to the master connection instead of failing (ISSUE #342).
    • ๐Ÿ›  FIX : the two connection backends based on ext-phpiredis has some kind of issues with the GC and the internal use of closures as reader callbacks that prevented connections going out of scope from being properly collected and the underlying stream or socket resources from being closed and freed. This should not have had any actual effect in real-world scenarios due to the lifecycle of PHP scripts, but we fixed it anyway (ISSUE #345).

    Other links

  • v1.1.0 Changes

    June 02, 2016

    Introduction

    ๐Ÿš€ This is a minor release of Predis packed with new features and various improvements of existing ones. As usual you can read the CHANGELOG for a schematic list of the changes. Thanks to anyone who provided feedback, especially on the new features, and proposed changes implemented in this release! Starting today we also have a chat room on Gitter, for now it's kind of an experiment but we'll see on the long run if it'll prove to be useful.

    IMPORTANT : if you are using "predis/predis": "dev-master" in composer.json then replace the requirement with tagged releases in the v1.1 branch as soon as possible! Starting today the master branch will host the development of the next major version of Predis, the first few commits containing some major breaking changes will land there in a matter of days meaning that if you won't replace dev-master your applications may (and most likely will) fail all of sudden.

    NOTE : speaking of Predis v2.0 we are aiming to bump the minimum required version of PHP to 5.5.9 (most likely to happen) and drop PEAR for distribution (still to be decided). The v1.1 branch will be maintaned for fixes so if you are stuck with PHP 5.3 and 5.4 you don't have too much to worry about for a while. If you have anything to say on the matter please join the discussion by leaving a comment or a reaction on #335, we need your feedback!

    ๐Ÿ†• New features

    Support for redis-sentinel is finally baked into Predis! As usual configuring the client is easy, it's just a matter of providing a list of sentinel servers and configure the client accordingly:

    $parameters = ['tcp://127.0.0.1:5380', 'tcp://127.0.0.1:5381', 'tcp://127.0.0.1:5382'];$options = ['replication' =\> 'sentinel', // use the appropriate replication backend'service' =\> 'mymaster', // provide a service name for discovery];$client = new Predis\Client($parameters, $options);
    

    See replication_sentinel.php for a complete example.

    Redis servers protected by SSL-encrypted connections can be accessed by using the tls or rediss scheme in connection parameters along with SSL-specific options in the ssl parameter (array):

    // Parameters in the form of a named array$parameters = ['scheme' =\> 'tls','host'=\> '127.0.0.1','ssl'=\> ['cafile' =\> '/path/to/redis.pem','verify\_peer\_name' =\> true,],];// Parameters in the form of an URI string$parameters = 'tls://127.0.0.1?ssl[cafile]=/path/to/redis.pem&ssl[verify\_peer\_name]=1';
    

    0๏ธโƒฃ Implemented the ability to specify default connection parameters for aggregate connections with the new parameters client option. These parameters augment the usual user-supplied connection parameters (but do not take the precedence over them) when creating new connections and they are mostly useful when the client is using aggregate connections such as redis-cluster and redis-sentinel as these backends can create new connections on the fly based on responses and redirections from Redis:

    $parameters = ['tcp://127.0.0.1:6381', 'tcp://127.0.0.1:6382', 'tcp://127.0.0.1:6383'];$options = ['cluster' =\> 'redis',// New connections to Redis will be created using the same following parameters:'parameters' =\> ['database' =\> 5, 'password' =\> $secret],];$client = new Predis\Client($parameters, $options);
    

    Predis\Client implements the IteratorAggregate interface making it is possible to iterate over traversable aggregate connections and get a new client instance for each Redis node:

    $client = new Predis\Client($parameters, ['cluster' =\> 'redis']);foreach ($client as $nodeClient) {$nodeClient-\>flushdb(); // executes FLUSHDB on each node of the cluster}
    

    ๐Ÿ”„ Changes

    • 0๏ธโƒฃ The default server profile for the client now targets Redis 3.2.
    • ๐Ÿšš Responses to the following list of commands are not casted into booleans anymore but instead the original integer value of the response is returned: SETNX, MSETNX, SMOVE, SISMEMBER, HSET, HSETNX, HEXISTS, PFADD, EXISTS, MOVE, PERSIST, EXPIRE, EXPIREAT, RENAMENX. This change does not have a significant impact unless when using strict comparisons (=== and !==) on the returned value.
    • ๐Ÿš€ Using unix:///path/to/socket in URI strings to specify a UNIX domain socket file is now deprecated in favor of the format unix:/path/to/socket (note the lack of the double slash after the scheme) and will not be supported starting with the next major release.
    • ๐Ÿ‘ป The client throws exceptions when Redis returns any kind of error response to initialization commands (the ones being automatically sent when a connection is established, such as SELECT and AUTH when database and password are set in connection parameters) regardless of the value of the exception option.
    • ๐Ÿšš Iterating over an instance of Predis\Connection\Aggregate\RedisCluster will return all the connections mapped in the slots map instead of just the ones in the in-memory pool. This change makes it possible, when the slots map is retrieved from Redis, to iterate over all of the master nodes in the cluster. When the use of CLUSTER SLOTS is disabled via the useClusterSlots() method, the iteration returns only the connections with slots ranges associated in their parameters or the ones initialized by -MOVED responses in order to make the behaviour of the iteration consistent between the two modes of operation.

    ๐Ÿ‘Œ Improvements

    Non-boolean string values passed to the persistent connection parameter can be used to create different persistent connections to the same host-port pair:

    // $parameters1 and $parameters2 will create two different persistent connections:$parameters1 = "tcp://127.0.0.1:6379?persistent=first";$parameters2 = "tcp://127.0.0.1:6379?persistent=second";
    

    Note that this feature was already present in Predis but required both persistent and path to be set as illustrated by #139, this change was needed to prevent confusion with how path is used to select a database when using the redis scheme.

    Various improvements to Predis\Connection\Aggregate\MasterSlaveReplication (the "basic" replication backend, not the new one based on redis-sentinel):

    • When the client is not able to send a read-only command to a slave because the current connection fails or the slave is resyncing (-LOADING response returned by Redis), the backend discards the failed connection and performs a new attempt on the next slave. When no other slave is available the master server is used for read-only commands as last resort.
    • It is possible to discover the current replication configuration on the fly by invoking the discover() method which internally relies on the output of the command INFO REPLICATION executed against the master server or one of the slaves. The backend can also be configured to do this automatically when it fails to reach one of the servers.
    • Implemented the switchToMaster() and switchToSlave() methods to make it easier to force a switch to the master server or a random slave when needed.

    Other links

  • v1.0.4 Changes

    May 30, 2016

    ๐Ÿš€ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.

    IMPORTANT : Predis v1.1.0 is going to be released in just a few days, this minor release will ship with various improvements and the much-awaited support for redis-sentinel. Soon after that the master branch will host the development of Predis v2.0 and the first major change will be a bump of the minimum required version of PHP to 5.5.9, please read about it here and leave a comment if you have something to say on the matter as the decision has not been finalized as of yet.

    ๐Ÿ‘Œ Improvements

    • โž• Added a new profile for Redis 3.2 with its new commands: HSTRLEN, BITFIELD, GEOADD, GEOHASH, GEOPOS, GEODIST, GEORADIUS, GEORADIUSBYMEMBER. The default server profile for Predis is still the one for Redis 3.0 so you must set the profile client option to 3.2 when initializing the client in order to be able to use them when connecting to Redis 3.2.
    • redis-cluster: when the connection to a specific node fails the client tries to connect to another node in order to refresh the slots map and perform a new attempt to execute a command.
    • redis-cluster: connections to nodes can now be preassigned to non-contiguous slot ranges via the slots parameter using a comma separator (e.g. tcp://127.0.0.1:6379?slots=0-5460,5500-5600,11000)

    ๐Ÿ› Bug fixes

    • ๐Ÿ›  FIX : Predis\Collection\Iterator\HashKey was returning corrupted values when iterating hash keys containing integer fields (PR #330, ISSUE #331).
    • ๐Ÿ›  FIX : Predis\Connection\StreamConnection and Predis\Protocol\Text\RequestSerializer do not fail when serializing commands with holes in their arguments (e.g. [0 => 'key:0', 2 => 'key:2']) just like the phpiredis-based connection backends (ISSUE #316).

    Other links

  • v1.0.3 Changes

    July 30, 2015

    ๐Ÿš€ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.

    IMPORTANT NOTICE : this release supersedes v1.0.2.

    ๐Ÿ› Bug fixes

    • ๐Ÿ›  FIX : the previous release introduced a severe regression on HHVM preventing the client from connecting to Redis using IPv4 addresses. Code running on the standard PHP interpreter is unaffected. (#269)

    Other links

  • v1.0.2 Changes

    July 30, 2015

    ๐Ÿš€ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.

    IMPORTANT NOTICE : this release has been superseded by v1.0.3 due to a severe regression affecting only HHVM preventing the client from connecting to Redis using IPv4 addresses. Code running on the standard PHP interpreter is unaffected.

    ๐Ÿ‘Œ Improvements

    • ๐Ÿ‘ IPv6 is fully supported.
    • ๐Ÿ“œ The redis scheme can be used in URI strings and is considered an alias of tcp but the rules applied when parsing the URI follow the provisional registration document published by IANA while the usual Predis-specific rules still apply when using tcp and other schemes.
    • Implemented some missing commands: HSTRLEN (Redis >= 3.2), ZREVRANGEBYLEX (Redis >= 2.8) and MIGRATE (>= 2.6).
    • The ZADD modifiers NX|XX, CH, INCR introduced in Redis 3.0.2 can also be used with the simplified signature of this command where scores and members are passed as a named array.

    ๐Ÿ› Bug fixes

    • ๐Ÿ›  FIX : Predis\Configuration\Options must not trigger the autoloader when values are strings (#257).
    • ๐Ÿ›  FIX : BITPOS was not defined in the key-prefix processor (#265) and in the replication strategy.

    Notes

    • ๐Ÿ›  Predis v1.1.0 should follow in just a few weeks and, being a minor release, will deliver more than just bugfixes or minor improvements. The addition of support for redis-sentinel is a long-standing feature request that will hopefully find its way into the library (see #131) and some major and much needed improvements to redis-cluster are also scheduled (see #173). As usual any help is more than appreciated so feel free to hop on these issues for sharing ideas and advices, or even contribute with a pull request.

    Other links

  • v1.0.1 Changes

    July 30, 2015

    ๐Ÿš€ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.

    ๐Ÿ‘Œ Improvements

    • โž• Added the BITPOS command to the server profile for Redis 2.8 (pull request by @nicchap).
    • 0๏ธโƒฃ It is now possible to specify a timeout for read/write operations also when using UNIX domain sockets with Predis\Connection\StreamConnection which is the default connection class based on PHP's streams (pull request by @srhnsn).

    ๐Ÿ› Bug fixes

    • ๐Ÿ‘€ A bug prevented Predis\Collection\Iterator\SortedSetKey to work correctly when iterating over sorted sets containing integer members (see #216).
    • ๐Ÿ‘€ Applied a workaround for a bug in old versions of PHP < 5.3.9 affecting inheritance (see 99f4312).
    • Prevent E_NOTICE messages from being emitted when requesting empty or unexistent info sections using INFO.

    Notes

    • ๐Ÿš€ Due to a bug in HHVM <= 3.4.0, it is not possible to use Predis\PubSub\Consumer and Predis\Monitor\Consumer when running under Facebook's runtime for now. You can find more details in the discussion on #231 (thanks @rubensayshi for the catch!) which also provides an hack to work around this issue until the next release of HHVM will ship with their bug fixed.

    Downloads