Skip to content

Instantly share code, notes, and snippets.

@nrk
Created February 12, 2011 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrk/823727 to your computer and use it in GitHub Desktop.
Save nrk/823727 to your computer and use it in GitHub Desktop.
Predis 0.6.4 (2011-02-12) - Release notes

Predis 0.6.4 (2011-02-12) - Release notes

Predis is a flexible and feature-complete PHP client library for Redis. This is a maintenance release for the 0.6 series that features mainly performance improvements. As with previous releases, Predis is also available for PHP 5.2 with an officially supported backport (PHP >= 5.2.6). What follows is an overview of the new features introduced in this new release. For a more in-depth list of changes please see the CHANGELOG.

Please read also the roadmap for future releases paragraph.

New features and changes

Performance improvements

Various performance tweaks have been made for this release resulting in a faster reply parsing for big multi-bulk replies (that is, replies to commands that return list of elements such as LRANGE and KEYS) and more optimized code for client-side sharding. This is only a start since most of the speed / overhead improvements will be available starting from Predis 0.7.0, but the library is now 15% / 25% faster on average than previous versions in the above said scenario without any breaking changes to the public API.

MULTI / EXEC and automatic retries

Predis\MultiExecBlock now supports a new on_retry option accepting an external callback (any kind of callable object) that gets invoked whenever the server aborts a transaction and the client attempts to replay it.

$options = array(
    'watch' => array('foo'), 'cas' => true, 'retry' => 2, 
    'on_retry' => function($tx, $attemptsLeft) {
        echo "Number of attempts left: $attemptsLeft";
    },
);

$redis->multiExec($options, function($tx) {
    // Code for MULTI / EXEC transaction
});

PUBSUB automatic subscribption

Predis\PubSubContext can be initialized with the subscribe and psubscribe options to let the client transparently subscribe to the specified channels before entering the PUBSUB loop.

$subscriptions = array(
    'subscribe'  => array('control_channel', 'notifications'), 
    'psubscribe' => 'channel_*',
);

foreach ($redis->pubSubContext($subscriptions) as $message) {
    // PUBSUB loop
}

Notes

Roadmap for future releases

Predis 0.7.0 is currently in the works and it will be a major release with a whole lot of breaking changes (excepts for the Redis commands) and, for this very same reason, this is probably the right time to drop the backported version for PHP 5.2 and support only PHP >= 5.3. A lot of thoughts have been put into this decision and while such an online poll does not have statistical relevance given the low numbers, it shows an interesting tendency among developers that use Predis. If you add to that the fact that most of the recent frameworks are PHP 5.3-only and even the recently released Debian 6.0 Squeeze now ships with it, you should pretty much realize how PHP 5.3 is no more the future of PHP but its present. That said, those still relying on PHP 5.2 can continue using Predis 0.6: this version is very stable and feature complete and it is also very unlikely that Redis is going to add some new features soon that will require deep changes to the library to implement them. Basically, there is no pressing reason for you to upgrade. To ease this transition, Predis 0.6 will probably be officially maintained for a few months after the release of 0.7.

Downloads

  • ** PHP 5.3 ** (mainline): TGZ or ZIP
  • ** PHP 5.2 ** (backport): TGZ or ZIP

Useful links

Release notes for previous versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment