From 3912bd3125b790f6e55d370347b5bf71559b1fc9 Mon Sep 17 00:00:00 2001 From: Hans Kuijpers <info@hkweb.nl> Date: Thu, 16 May 2013 15:29:54 +0200 Subject: [PATCH] Update README.md added an alternative connection to Redis. Copied this information from https://raw.github.com/nrk/predis/v0.8/README.md --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index e4eae81..21b5885 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,28 @@ A WordPress object cache backend that implements all available methods using Red 2. Install Predis (included in this repository as a submodule) in the `/wp-content/predis` directory, since that's where the object cache expects it to reside. 3. Add object-cache.php to the wp-content directory. It is a drop-in file, not a plugin, so it belongs in the wp-content directory, not the plugins directory. 4. By default, the script will connect to Redis at 127.0.0.1:6379. + +### Connecting to Redis ### + +By default Predis uses `127.0.0.1` and `6379` as the default host and port when creating a new client +instance without specifying any connection parameter: + +```php +$redis = new Predis\Client(); +$redis->set('foo', 'bar'); +$value = $redis->get('foo'); +``` + +It is possible to specify the various connection parameters using URI strings or named arrays: + +```php +$redis = new Predis\Client('tcp://10.0.0.1:6379'); + +// is equivalent to: + +$redis = new Predis\Client(array( + 'scheme' => 'tcp', + 'host' => '10.0.0.1', + 'port' => 6379, +)); +``` -- GitLab