1111 */
1212
1313$ config = array (
14- /*
15- * Default storage
16- * if you set this storage => "files", then $cache = phpFastCache(); <-- will be files cache
17- */
18- "storage " => "auto " , // files, sqlite, auto, apc, wincache, xcache, memcache, memcached,
14+ "storage " => "auto " , // auto, files, sqlite, apc, cookie, memcache, memcached, predis, redis, wincache, xcache
15+ "default_chmod " => 0777 , // For security, please use 0666 for module and 0644 for cgi.
1916
20- /*
21- * Default Path for Cache on HDD
22- * Use full PATH like /home/username/cache
23- * Keep it blank "", it will automatic setup for you
24- */
25- "path " => "" , // default path for files
26- "securityKey " => "" , // default will good. It will create a path by PATH/securityKey
2717
2818 /*
29- * FallBack Driver
30- * Example, in your code, you use memcached, apc..etc, but when you moved your web hosting
31- * The new hosting don't have memcached, or apc. What you do? Set fallback that driver to other driver.
19+ * OTHERS
3220 */
33- "fallback " => "files " ,
3421
35- /*
36- * .htaccess protect
37- * default will be true
38- */
39- "htaccess " => true ,
22+ // create .htaccess to protect cache folder
23+ // By default the cache folder will try to create itself outside your public_html.
24+ // However an htaccess also created in case.
25+ "htaccess " => true ,
26+
27+ // path to cache folder, leave it blank for auto detect
28+ "path " => "" ,
29+ "securityKey " => "auto " , // auto will use domain name, set it to 1 string if you use alias domain name
30+
31+ // MEMCACHE
4032
41- /*
42- * Default Memcache Server for all $cache = phpFastCache("memcache");
43- */
4433 "memcache " => array (
45- array ("127.0.0.1 " ,11211 ,1 ),
34+ array ("127.0.0.1 " ,11211 ,1 ),
4635 // array("new.host.ip",11211,1),
4736 ),
48- // Default server for redis
49- "redis " => array ("127.0.0.1 " ,6379 ),
5037
38+ // REDIS
39+ "redis " => array (
40+ "host " => "127.0.0.1 " ,
41+ "port " => "" ,
42+ "password " => "" ,
43+ "database " => "" ,
44+ "timeout " => ""
45+ ),
46+
47+ "extensions " => array (),
5148
49+
50+ /*
51+ * Fall back when old driver is not support
52+ */
53+ "fallback " => "files " ,
5254);
5355
5456phpFastCache::setup ($ config );
6466
6567$ config = array (
6668 // ALL OF YOUR CONFIG HERE
69+ // except storage
6770);
6871
69- $ cache = phpFastCache ("cache_method " ,$ config ); // this will be $config['storage'] up there;
72+ $ cache = phpFastCache ("files " ,$ config ); // this will be $config['storage'] up there;
7073
7174// changing config example
7275$ cache ->setup ("path " ,"new_path " );
7376
7477
75-
76-
77-
7878$ cache2 = phpFastCache ("memcache " ); // this will use memcache
79- $ cache3 = new phpFastCache ("apc " ); // this will use apc
80-
81-
82-
83- // something new ???
84- $ products = $ cache ->my_products ;
85- if ($ products == null ) {
86- $ products = "object | array | function_get_products " ;
87- // write to cache
88- $ cache ->my_products = array ($ products , 600 );
89- }
90-
91- echo $ products ;
79+ $ server = array (
80+ array ("127.0.0.1 " ,11211 ,1 ),
81+ );
82+ $ cache2 ->setup ("memcache " ,$ server );
0 commit comments