Browse Source

Light rewording and reorganization of README.

[ci skip]
Daniele Alessandri 10 years ago
parent
commit
7b41029fd7
1 changed files with 49 additions and 48 deletions
  1. 49 48
      README.md

+ 49 - 48
README.md

@@ -22,9 +22,9 @@ on the online [wiki](https://github.com/nrk/predis/wiki).
 
 - Wide range of Redis versions supported (from __2.0__ to __3.0__ and __unstable__) using profiles.
 - Clustering via client-side sharding using consistent hashing or custom distributors.
-- Smart support for [redis-cluster](http://redis.io/topics/cluster-spec) (Redis >= 3.0).
+- Smart support for [redis-cluster](http://redis.io/topics/cluster-tutorial) (Redis >= 3.0).
 - Support for master-slave replication configurations (write on master, read from slaves).
-- Transparent key prefixing for all Redis commands using a customizable prefixing strategy.
+- Transparent key prefixing for all known Redis commands using a customizable prefixing strategy.
 - Command pipelining (works on both single and aggregate connections).
 - Abstraction for Redis transactions (Redis >= 2.0) supporting CAS operations (Redis >= 2.2).
 - Abstraction for Lua scripting (Redis >= 2.6) with automatic switching between `EVALSHA` or `EVAL`.
@@ -176,43 +176,7 @@ automatic retries of transactions aborted by Redis when `WATCH`ed keys are touch
 of a transaction using CAS you can see [the following example](examples/transaction_using_cas.php).
 
 
-### Customizable connection backends ###
-
-Predis can use different connection backends to connect to Redis. Two of them leverage a third party
-extension such as [phpiredis](https://github.com/nrk/phpiredis) resulting in major performance gains
-especially when dealing with big multibulk responses. While one is based on PHP streams, the other
-is based on socket resources provided by `ext-socket`. Both support TCP/IP or UNIX domain sockets:
-
-```php
-$client = new Predis\Client('tcp://127.0.0.1', [
-    'connections' => [
-        'tcp'  => 'Predis\Connection\PhpiredisStreamConnection',  // PHP streams
-        'unix' => 'Predis\Connection\PhpiredisSocketConnection',  // ext-socket
-    ],
-]);
-```
-
-Developers can create their own connection classes to add support for new network backends, extend
-existing ones or provide completely different implementations. Connection classes must implement
-`Predis\Connection\NodeConnectionInterface` or extend `Predis\Connection\AbstractConnection`:
-
-```php
-class MyConnectionClass implements Predis\Connection\NodeConnectionInterface
-{
-    // Implementation goes here...
-}
-
-// Use MyConnectionClass to handle connections for the `tcp` scheme:
-$client = new Predis\Client('tcp://127.0.0.1', [
-    'connections' => ['tcp' => 'MyConnectionClass'],
-]);
-```
-
-For a more in-depth insight on how to create new connection backends you can refer to the actual
-implementation of the standard connection classes available in the `Predis\Connection` namespace.
-
-
-### Adding support for new commands ###
+### Adding new commands ###
 
 While we try to update Predis to stay up to date with all the commands available in Redis, you might
 prefer to stick with an older version of the library or provide a different way to filter arguments
@@ -236,7 +200,7 @@ $client->getProfile()->defineCommand('newcmd', 'BrandNewRedisCommand');
 $response = $client->newcmd();
 ```
 
-There is also a method to allow sending raw commands without filtering their arguments or parsing
+hTere is also a method to allow sending raw commands without filtering their arguments or parsing
 responses. Users must provide the arguments list as an array, following the command signatures as
 defined by the [Redis documentation for commands](http://redis.io/commands):
 
@@ -245,15 +209,16 @@ $response = $client->executeRaw(['SET', 'foo', 'bar']);
 ```
 
 
-### Scriptable commands ###
+### Script commands ###
 
-A scriptable command is just an abstraction for [Lua scripting](http://redis.io/commands/eval) that
-aims to simplify the usage of scripting with Redis >= 2.6. Scriptable commands can be registered in
-the server profile used by the client and are accessible as if they were plain Redis commands, but
-they define a Lua script that gets transmitted to Redis for remote execution. Internally, scriptable
-commands use by default [EVALSHA](http://redis.io/commands/evalsha) and identify a Lua script by its
-SHA1 hash to save bandwidth but [EVAL](http://redis.io/commands/eval) is automatically preferred as
-a fall back when needed:
+While it is possible to leverage [Lua scripting](http://redis.io/commands/eval) on Redis 2.6+ using
+[EVAL](http://redis.io/commands/eval) and [EVALSHA](http://redis.io/commands/evalsha), Predis offers
+script commands as an higher level abstraction aiming to make things simple. Script commands can be
+registered in the server profile used by the client and are accessible as if they were plain Redis
+commands, but they define a Lua script that gets transmitted to the server for remote execution.
+Internally they use [EVALSHA](http://redis.io/commands/evalsha) by default and identify a Lua script
+by its SHA1 hash to save bandwidth, but [EVAL](http://redis.io/commands/eval) is automatically used
+as a fall back when needed:
 
 ```php
 // Define a new scriptable command by extending Predis\Command\ScriptCommand:
@@ -283,6 +248,42 @@ $response = $client->lpushrand('random_values', $seed = mt_rand());
 ```
 
 
+### Customizable connection backends ###
+
+Predis can use different connection backends to connect to Redis. Two of them leverage a third party
+extension such as [phpiredis](https://github.com/nrk/phpiredis) resulting in major performance gains
+especially when dealing with big multibulk responses. While one is based on PHP streams, the other
+is based on socket resources provided by `ext-socket`. Both support TCP/IP or UNIX domain sockets:
+
+```php
+$client = new Predis\Client('tcp://127.0.0.1', [
+    'connections' => [
+        'tcp'  => 'Predis\Connection\PhpiredisStreamConnection',  // PHP streams
+        'unix' => 'Predis\Connection\PhpiredisSocketConnection',  // ext-socket
+    ],
+]);
+```
+
+Developers can create their own connection classes to add support for new network backends, extend
+existing ones or provide completely different implementations. Connection classes must implement
+`Predis\Connection\NodeConnectionInterface` or extend `Predis\Connection\AbstractConnection`:
+
+```php
+class MyConnectionClass implements Predis\Connection\NodeConnectionInterface
+{
+    // Implementation goes here...
+}
+
+// Use MyConnectionClass to handle connections for the `tcp` scheme:
+$client = new Predis\Client('tcp://127.0.0.1', [
+    'connections' => ['tcp' => 'MyConnectionClass'],
+]);
+```
+
+For a more in-depth insight on how to create new connection backends you can refer to the actual
+implementation of the standard connection classes available in the `Predis\Connection` namespace.
+
+
 ## Development ##