Using Predix Cache with PHP

Get code samples and recommended libraries for using a Predix Cache service with PHP.

Code Samples for Using Predix Cache with PHP

Recommended Libraries
predis. See https://github.com/nrk/predis
Alternative Libraries
phpredis. See https://github.com/phpredis/phpredis

Code Sample Using predis Library

To install the library, add the predis package to your requirements in composer.json:
"require": {
  "redis/predis": "1.1",
}
predis Sample for Shared and Dedicated Single Node Service Plans
// Parameters passed using a named array:
$client = new Predis\Client([
    'scheme' => 'tcp',
    'host'   => '10.0.0.1',
    'port'   => 6379,
]);

// Same set of parameters, passed using an URI string:
$client = new Predis\Client('tcp://10.0.0.1:6379');