forked from PHPSocialNetwork/phpfastcache
/
example.php
90 lines (87 loc) · 3.8 KB
/
example.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
include("php_fast_cache.php");
/*
* Optional Config || You can skip these config, everything is Automatic ^_^
* -----------------------------
* phpFastCache::$storage = "auto"; // auto | pdo | mpdo | files | memcache | memcached | apc | wincache
* -----------------------------
* Just Remember Only 2 Functions: Set & Get.
* SET Functions
* phpFastCache::set("item_name", $value, second);
* OR
* phpFastCache::set("item_name", $value, second, true); // skip if existing
*
* phpFastCache::set(array("apc" => "item_name"), $value, 600);
* phpFastCache::set(array("files" => "item_name"), $value, 600);
* phpFastCache::set(array("memcached" => "item_name"), $value, 600);
* phpFastCache::set(array("pdo" => "item_name"), $value, 600);
*
* phpFastCache::set(array("files/2013/categories" => "item_name"), $value, 600);
* phpFastCache::set(array("db1" => "item_name"), $value, 600);
* phpFastCache::set(array("db2" => "item_name"), $value, 600);
* phpFastCache::set(array("db3" => "item_name"), $value, 600);
* phpFastCache::set(array("prefix" => "item_name"), $value, 600);
*
* GET FUNCTIONS ( return NULL or Value of item )
* phpFastCache::get("item_name");
* phpFastCache::get(array("prefix" => "item_name"));
*
* -----------------------------
* -----------------------------
* -----------------------------
* -----------------------------
*
* Others Functions if you are interesting
* item_name can be string or array("where" => "name");
*
* phpFastCache::delete("item_name");
* phpFastCache::cleanup("item_name");
* phpFastCache::stats();
* phpFastCache::increment("item_name", $step = 1);
* phpFastCache::decrement("item_name", $step = 1);
* phpFastCache::exists("item_name");
* print_r(phpFastCache::$sys);
*
* -----------------------------
* -----------------------------
* -----------------------------
* phpFastCache::setMulti(array(
* array("a","hello",600),
* array("b","value")),
* 500,
* false);
*
* phpFastCache::setMulti(array(
* array("a","hello"),
* array("b","value")),
* 3600*24);
*
* phpFastCache::setMulti(array(
* array("files" => "a", "data", 3600*24),
* array("apc" => "b", "hello world", 500),
* array("c", "array|object|info"));
*
* phpFastCache::getMulti(array("a","b","c"));
* phpFastCache::getMulti(array("files" => "a", "apc" => "b", "c"));
*
* phpFastCache::deleteMulti(array("a","b","c"));
* phpFastCache::deleteMulti(array("files" => "a", "memcached" => "b", "c"));
*
*
* ----------------------------
* Custom PATH & Security
* phpFastCache::$path = "/PATH/FOR_PDO_FILES/"; need chmod 0777 or writable mode
* phpFastCache::$securityKey = "cache.storage"; default cache folder name;
* phpFastCache::$server = array(
* array("localhost",11211,30),
* array("localhost",11211,70)
* ); <-- Memcache Server
* -----------------------------
* -----------------------------
* -----------------------------
* -----------------------------
*/
/*
* Example at http://www.phpfastcache.com
*/
?>