forked from mtaneja/php-pecl-memcache-zynga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappend_prepend.php
52 lines (36 loc) · 1.01 KB
/
append_prepend.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
$memcache = new memcache;
$memcache->addServer("localhost", 11211);
if ($memcache) {
$memcache->set("k1", "whats her name");
$memcache->append("k1", "? pappu yadav ");
var_dump($memcache->get("k1"));
$result = $memcache->append("k9", "rather stupid idea"); /* should fail */
if ($result == false) {
echo "pass ! \n";
}
$result = $memcache->prepend("k9", "rather silly idea"); /* should fail */
echo $result;
if ($result == false) {
echo "pass ! \n";
}
$memcache->prepend("k1", "who wrote toy soldiers ? ");
var_dump($memcache->get("k1"));
/*
echo "haha";
var_dump($memcache->getl("k1"));
$memcache->set("k1", "lizzi the wizzi");
var_dump($memcache->get('k1'));
$memcache->set("k1", 25);
$memcache->getl("k1");
$memcache->increment("k1", 5);
$memcache->add("k1", 50, 0);
$memcache->delete("k1");
$return = $memcache->getl("z1");
var_dump($return);
*/
}
else {
echo "Connection to memcached failed";
}
?>