Last active
August 29, 2015 14:20
-
-
Save wonjun27/665428b56d08991bc6ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// WARNING: right now, support for redis-cluster is experimental, | |
// unoptimized and in its very early stages of development. To | |
// play with it you must have a correct setup of redis-cluster | |
// running (oh hai mr. obvious) and Predis v0.7-dev fetched from | |
// the redis_cluster branch of the Git repository. | |
require 'autoload.php'; | |
$servers = array( | |
'tcp://127.0.0.1:6379', | |
'tcp://127.0.0.1:6380', | |
'tcp://127.0.0.1:6381', | |
); | |
// Developers can specify which kind of cluster strategy the | |
// client should use with the recently added 'cluster' option | |
// and the following values: | |
// - predis : good old client-side sharding (default) | |
// - redis : redis-cluster | |
$client = new Predis\Client($servers, array('cluster' => 'redis')); | |
$client->set("foo", "bar"); | |
$foo = $client->get("foo"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment