packagist predis/predis v1.1.4
Predis v1.1.4

latest releases: dev-main, v2.x-dev, dev-z-prefixes...
3 years ago

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\HashRing::addNodeToRing() 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).

Don't miss a new predis release

NewReleases is sending notifications on new releases.