-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
47 lines (41 loc) · 905 Bytes
/
index.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
<?php
require('key-value-api.php');
// $Servers = [
// ['127.0.0.1', 11211],
// ['localhost', 11211],
// ['127.0.0.1']
// ];
//$Servers = [
// '127.0.0.1:11211', 'localhost:11211', '127.0.0.1'
//];
$Servers = '127.0.0.1:11211;localhost:11211;127.0.0.1';
try
{
$KV = new kv(
array('Enabled' => false),
array('Enabled' => true, 'Servers' => $Servers)
);
}
catch (Exception $E)
{
echo $E -> getMessage();
}
// Object style
$KV['Value1'] = 'asdf';
echo $KV['Value1']; // Outputs "asdf"
echo '<hr />';
// Static class style
echo kv::get('Value1'); // Outputs "asdf";
echo '<hr />';
kv::set('Value1', 'qwerty');
echo kv::get('Value1'); // Outputs "qwerty";
echo '<hr />';
kv::clear_all();
echo kv::get('Value1'); // Outputs "";
echo '<hr />';
kv::set('TestNumber', 42);
echo $KV['TestNumber'];
echo '<hr />';
kv::inc('TestNumber', 2);
echo $KV['TestNumber'];
?>