From 81422b9992ee077d4c59a0c185072f20d8727e74 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Thu, 2 Aug 2012 16:10:26 +0200 Subject: [PATCH] Partially rewrite README. [ci skip] --- README.md | 74 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index bb3860e9..168aaa61 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,21 @@ Predis is a flexible and feature-complete PHP (>= 5.3) client library for the Redis key-value store. -For a list of frequently asked questions about Predis, see the __FAQ__ file in the root of the repository. -For a version compatible with PHP 5.2 you must use the backported version from the latest release in the -0.6.x series. More details are available on the [official wiki](http://wiki.github.com/nrk/predis) of the -project. +For a list of frequently asked questions about Predis, see the __FAQ.md__ in the root of the repository. +More details are available on the [official wiki](http://wiki.github.com/nrk/predis) of the project. ## Main features ## -- Complete support for Redis from __1.2__ to __2.6__ and unstable versions using different server profiles. +- Wide range of Redis versions supported (from __1.2__ to __2.6__ and unstable) using server profiles. - Smart support for [redis-cluster](http://redis.io/topics/cluster-spec) (Redis >= 3.0). -- Client-side sharding with support for consistent hashing or custom distribution strategies. +- Client-side sharding via consistent hashing or custom distribution strategies. - Support for master / slave replication configurations (write on master, read from slaves). -- Command pipelining on single and aggregated connections. - Transparent key prefixing strategy capable of handling any command known that has keys in its arguments. +- Command pipelining on single and aggregated connections. - Abstraction for Redis transactions (Redis >= 2.0) with support for CAS operations (Redis >= 2.2). -- Abstraction for Lua scripting (Redis >= 2.6) capable of switching between EVAL and EVALSHA transparently. -- Connections to Redis instances are automatically and lazily estabilished upon the first call to a command. +- Abstraction for Lua scripting (Redis >= 2.6) capable of automatically switching between `EVAL` and `EVALSHA`. +- Connections to Redis instances are lazily estabilished upon the first call to a command by the client. - Ability to connect to Redis using TCP/IP or UNIX domain sockets with support for persistent connections. - Ability to use alternative connection classes to use different types of network or protocol backends. - Flexible system to define and register your own set of commands or server profiles to client instances. @@ -36,11 +34,11 @@ by browsing the list of [tagged releases](http://github.com/nrk/predis/tags). ### Loading the library ### -Predis relies on the autoloading features of PHP to automatically load the needed files and complies -with the [PSR-0 standard](http://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) for -interoperability with most of the major frameworks and libraries. Everything is transparently handled -for you when installing the library using Composer, but you can also leverage its own autoloader class -if you are going to use it in a project or script without any PSR-0 compliant autoloading facility: +Predis relies on the autoloading features of PHP to load its files when needed and complies with the +[PSR-0 standard](http://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) which makes it +compatible with most of the major frameworks and libraries. Autoloading in your application is handled +automatically when managing the dependencies with Composer, but you can also leverage its own autoloader +class if you are going to use it in a project or script without any PSR-0 compliant autoloading facility: ``` php set('foo', 'bar'); $value = $redis->get('foo'); ``` -However you can use an URI string or a named array to specify the needed connection parameters: +It is possible to specify the various connection parameters using URI strings or named arrays: ``` php pipeline(function ($pipe) { ``` -### Overriding standard connection classes with custom ones ### +### Multiple and customizable connection backends ### -Predis allows developers to create new connection classes to add support for new protocols or override -the existing ones and provide a different implementation compared to the default classes. This can be -obtained by implementing `Predis\Connection\SingleConnectionInterface`. +Predis can optionally use different connection backends to connect to Redis. One of them leverages +the [phpiredis](http://github.com/seppo0010/phpiredis) C extension resulting in a major speed bump +especially when dealing with long multibulk replies (the `socket` extension is also required): + +``` php +$client = new Predis\Client('tcp://127.0.0.1', array( + 'connections' => array('tcp' => 'Predis\Connection\PhpiredisConnection') +)); +``` + +Developers can also create their own connection backends to add support for new protocols, extend +existing ones or provide different implementations. Connection backend classes must implement +`Predis\Connection\SingleConnectionInterface` or extend `Predis\Connection\AbstractConnection`: ``` php