Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions BETA
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
*** PLEASE READ ***

The library code in this branch is the result of a major rewrite of Predis 0.6
and is considered of BETA quality, which means that there should not be any
known outstanding bug and that the internal API is almost finalized and fixed
The library code in this branch is the result of a major rewrite of Predis 0.6
and is considered of BETA quality, which means that there should not be any
known outstanding bug and that the internal API is almost finalized and fixed
(but it could still be subject to slight changes if needed).

Feedback is obviously appreciated and even if things should just work, use it
at your own risk! If you need to use Predis in a production environment please
Feedback is obviously appreciated and even if things should just work, use it
at your own risk! If you need to use Predis in a production environment please
use a tagged release or checkout the version-0.6 branch from the repository.
186 changes: 93 additions & 93 deletions CHANGELOG

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ For a version compatible with PHP 5.2 you must use the backported version from t

## Quick examples ##

See the [official wiki](http://wiki.github.com/nrk/predis) of the project for a more
See the [official wiki](http://wiki.github.com/nrk/predis) of the project for a more
complete coverage of all the features available in Predis.


### Loading Predis

Predis relies on the autoloading features of PHP and complies with the
[PSR-0 standard](http://groups.google.com/group/php-standards/web/psr-0-final-proposal)
Predis relies on the autoloading features of PHP and complies with the
[PSR-0 standard](http://groups.google.com/group/php-standards/web/psr-0-final-proposal)
for interoperability with most of the major frameworks and libraries.

When used in a project or script without PSR-0 autoloading, Predis includes its own autoloader for you to use:
Expand All @@ -41,19 +41,19 @@ Predis\Autoloader::register();
// requiring any additional files.
```

You can also create a single [Phar](http://www.php.net/manual/en/intro.phar.php) archive from the repository
just by launching the `createPhar.php` script located in the `bin` directory. The generated Phar ships with
a stub that defines an autoloader function for Predis, so you just need to require the Phar archive in order
You can also create a single [Phar](http://www.php.net/manual/en/intro.phar.php) archive from the repository
just by launching the `createPhar.php` script located in the `bin` directory. The generated Phar ships with
a stub that defines an autoloader function for Predis, so you just need to require the Phar archive in order
to be able to use the library.

Alternatively you can generate a single PHP file that holds every class, just like older versions of Predis,
using the `createSingleFile.php` script located in the `bin` directory. In this way you can load Predis in
Alternatively you can generate a single PHP file that holds every class, just like older versions of Predis,
using the `createSingleFile.php` script located in the `bin` directory. In this way you can load Predis in
your scripts simply by using functions such as `require` and `include`, but this practice is not encouraged.


### Connecting to a local instance of Redis ###

You don't have to specify a tcp host and port when connecting to Redis instances running on the
You don't have to specify a tcp host and port when connecting to Redis instances running on the
localhost on the default port:

``` php
Expand Down Expand Up @@ -81,9 +81,9 @@ $redis = new Predis\Client(array(

### Pipelining multiple commands to multiple instances of Redis with client-side sharding ###

Pipelining helps with performances when there is the need to issue many commands to a server
in one go. Furthermore, pipelining works transparently even on aggregated connections. Predis,
in fact, supports client-side sharding of data using consistent-hashing on keys and clustered
Pipelining helps with performances when there is the need to issue many commands to a server
in one go. Furthermore, pipelining works transparently even on aggregated connections. Predis,
in fact, supports client-side sharding of data using consistent-hashing on keys and clustered
connections are supported natively by the client class.

``` php
Expand All @@ -104,8 +104,8 @@ $replies = $redis->pipeline(function($pipe) {

### Overriding standard connection classes with custom ones ###

Predis allows developers to create new connection classes to add support for new protocols
or override the existing ones to provide a different implementation compared to the default
Predis allows developers to create new connection classes to add support for new protocols
or override the existing ones to provide a different implementation compared to the default
classes. This can be obtained by subclassing the `Predis\Network\IConnectionSingle` interface.

``` php
Expand All @@ -120,17 +120,17 @@ Predis\ConnectionFactory::define('tcp', 'MyConnectionClass');
```


You can have a look at the `Predis\Network` namespace for some actual code that gives a better
You can have a look at the `Predis\Network` namespace for some actual code that gives a better
insight about how to create new connection classes.


### Definition and runtime registration of new commands on the client ###

Let's suppose Redis just added the support for a brand new feature associated
with a new command. If you want to start using the above mentioned new feature
right away without messing with Predis source code or waiting for it to find
its way into a stable Predis release, then you can start off by creating a new
class that matches the command type and its behaviour and then bind it to a
Let's suppose Redis just added the support for a brand new feature associated
with a new command. If you want to start using the above mentioned new feature
right away without messing with Predis source code or waiting for it to find
its way into a stable Predis release, then you can start off by creating a new
class that matches the command type and its behaviour and then bind it to a
client instance at runtime. Actually, it is easier done than said:

``` php
Expand All @@ -151,19 +151,19 @@ $redis->newcmd();

## Development ##

Predis is fully backed up by a test suite which tries to cover all the aspects of the
client library and the interaction of every single command with a Redis server. If you
want to work on Predis, it is highly recommended that you first run the test suite to
Predis is fully backed up by a test suite which tries to cover all the aspects of the
client library and the interaction of every single command with a Redis server. If you
want to work on Predis, it is highly recommended that you first run the test suite to
be sure that everything is OK, and report strange behaviours or bugs.

When modifying Predis please be sure that no warnings or notices are emitted by PHP
by running the interpreter in your development environment with the `error_reporting`
When modifying Predis please be sure that no warnings or notices are emitted by PHP
by running the interpreter in your development environment with the `error_reporting`
variable set to `E_ALL | E_STRICT`.

The recommended way to contribute to Predis is to fork the project on GitHub, create
new topic branches on your newly created repository to fix or add features and then
open a new pull request with a description of the applied changes. Obviously, you can
use any other Git hosting provider of your preference. Diff patches will be accepted
The recommended way to contribute to Predis is to fork the project on GitHub, create
new topic branches on your newly created repository to fix or add features and then
open a new pull request with a description of the applied changes. Obviously, you can
use any other Git hosting provider of your preference. Diff patches will be accepted
too, even though they are not the preferred way to contribute to Predis.


Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* The internals of Predis\MultiExecContext should be refactored since the code
has become a bit too convoluted.

* Switch to smaller test units and add more granular tests that try to cover
* Switch to smaller test units and add more granular tests that try to cover
every single class.

* Documentation! The README is obviously not enought to show how to use Predis
Expand Down
2 changes: 1 addition & 1 deletion examples/DispatcherLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/*
This is a basic example on how to use the Predis\DispatcherLoop class.

To see this example in action you can just use redis-cli and publish some
To see this example in action you can just use redis-cli and publish some
messages to the 'events' and 'control' channel, e.g.:

./redis-cli
Expand Down
2 changes: 1 addition & 1 deletion examples/MultiExecTransactionsWithCAS.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// This is an implementation of an atomic client-side ZPOP using the support for
// check-and-set (CAS) operations with MULTI/EXEC transactions, as described in
// "WATCH explained" from http://redis.io/topics/transactions
//
//
// First, populate your database with a tiny sample data set:
//
// ./redis-cli
Expand Down
2 changes: 1 addition & 1 deletion examples/PipelineContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
[5] => 40
[6] => Array
(
[0] =>
[0] =>
[1] => 40
)

Expand Down
2 changes: 1 addition & 1 deletion lib/Predis/Commands/Processors/ProcessorChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function process(ICommand $command)
/**
* {@inheritdoc}
*/
public function getProcessors()
public function getProcessors()
{
return $this->_processors;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Predis/Distribution/HashRing.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function remove($node)
/**
* Resets the distributor.
*/
private function reset()
private function reset()
{
unset(
$this->_ring,
Expand Down Expand Up @@ -216,9 +216,9 @@ private function getNodeKey($key)
/**
* Implements a strategy to deal with wrap-around errors during binary searches.
*
* @param int $upper
* @param int $upper
* @param int $lower
* @param int $ringKeysCount
* @param int $ringKeysCount
* @return int
*/
protected function wrapAroundStrategy($upper, $lower, $ringKeysCount)
Expand Down
2 changes: 1 addition & 1 deletion lib/Predis/Pipeline/PipelineContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(Client $client, Array $options = null)
/**
* Returns a pipeline executor depending on the kind of the underlying
* connection and the passed options.
*
*
* @param Client Client instance used by the context.
* @param array Options for the context initialization.
* @return IPipelineExecutor
Expand Down
2 changes: 1 addition & 1 deletion lib/Predis/Protocol/ProtocolException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Predis\CommunicationException;

/**
* Exception class that identifies errors encountered while
* Exception class that identifies errors encountered while
* handling the Redis wire protocol.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion lib/Predis/ResponseError.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getErrorType()

/**
* Converts the object to its string representation.
*
*
* @return string
*/
public function __toString()
Expand Down
2 changes: 1 addition & 1 deletion lib/Predis/Transaction/MultiExecContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function unwatch()
}

/**
* Resets a transaction by UNWATCHing the keys that are being WATCHed and
* Resets a transaction by UNWATCHing the keys that are being WATCHed and
* DISCARDing the pending commands that have been already sent to the server.
*
* @return MultiExecContext
Expand Down
2 changes: 1 addition & 1 deletion test/ClientFeaturesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function testPipelineContext_ClientExceptionInCallableBlock()
$client->flushdb();

RC::testForClientException($this, 'TEST', function() use($client) {
$client->pipeline(function($pipe) {
$client->pipeline(function($pipe) {
$pipe->ping();
$pipe->set('foo', 'bar');
throw new Predis\ClientException("TEST");
Expand Down
8 changes: 4 additions & 4 deletions test/RedisCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase
// TODO: missing test with float values for a few commands

protected function setUp()
{
{
$this->redis = RC::getConnection();
$this->redis->flushdb();
}
Expand Down Expand Up @@ -613,7 +613,7 @@ function testListRange()
);

$this->assertEquals(
array(),
array(),
$this->redis->lrange('keyDoesNotExist', 0, 1)
);

Expand Down Expand Up @@ -1032,7 +1032,7 @@ function testSetIntersection()
$setB = RC::setAddAndReturn($this->redis, 'setB', array(1, 3, 4, 6, 9, 10));

$this->assertTrue(RC::sameValuesInArrays(
$setA,
$setA,
$this->redis->sinter('setA')
));

Expand Down Expand Up @@ -1423,7 +1423,7 @@ function testZsetRangeByScore()
$zset = RC::zsetAddAndReturn($this->redis, 'zset', RC::getZSetArray());

$this->assertEquals(
array('a'),
array('a'),
$this->redis->zrangebyscore('zset', -10, -10)
);

Expand Down