-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetByKey.php
34 lines (27 loc) · 869 Bytes
/
getByKey.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require_once("init.php");
$memcache = new memcache;
$memcache->debug(DEBUG);
$memcache->addServer("localhost", 11211);
$memcache->addServer("localhost1", 11211);
$memcache->addServer("localhost2", 11211);
$memcache->addServer("localhost3", 11211);
$memcache->addServer("localhost4", 11211);
if ($memcache) {
$val = null;
$key = "foo";
$shardKey = "foo";
$test = $memcache->getByKey($key, $shardKey, $val);
echo "key '$key' shardKey '$shardKey' result '$test' val: '$val'\n";
$key = "foo";
$shardKey = "123";
$test = $memcache->getByKey($key, $shardKey, $val);
echo "key '$key' shardKey '$shardKey' result '$test' val: '$val'\n";
$key = "fa;dfa;dfa;sdf;safoo";
$shardKey = "123";
$test = $memcache->getByKey($key, $shardKey, $val);
echo "key '$key' shardKey '$shardKey' result '$test' val: '$val'\n";
} else {
echo "Connection failed\n";
}
?>