Skip to content

Commit b3f4d6a

Browse files
committed
Version 3.0.0
1 parent 1771f93 commit b3f4d6a

File tree

305 files changed

+856
-977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+856
-977
lines changed

examples/1.learn.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414

1515
// Try to get $products from Caching First
1616
// product_page is "identity keyword";
17-
$products = $cache->get("product_page");
17+
$products = $cache->get("product_page_keyword");
1818

1919
if($products == null) {
2020
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
21-
// Write products to Cache in 10 minutes with same keyword
22-
$cache->set("product_page",$products , 600);
21+
// Write products to Cache in 10 second with same keyword
22+
// 600 = 60 x 10 = 10 minutes
23+
$cache->set("product_page_keyword",$products , 10);
24+
echo " THIS TIME RUN WITHOUT CACHE <br> ";
25+
} else {
26+
echo " USE CACHE, NO QUERY CALL <br> ";
2327
}
2428

2529
// use your products here or return it;

examples/2.setup.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,25 @@
6262
* End Optional Config
6363
*/
6464

65-
$cache = phpFastCache(); // this will be $config['storage'] up there;
65+
$config = array(
66+
// ALL OF YOUR CONFIG HERE
67+
);
68+
69+
$cache = phpFastCache("cache_method",$config); // this will be $config['storage'] up there;
70+
71+
// changing config example
72+
$cache->setup("path","new_path");
73+
74+
75+
76+
77+
6678
$cache2 = phpFastCache("memcache"); // this will use memcache
6779
$cache3 = new phpFastCache("apc"); // this will use apc
6880

81+
82+
83+
// something new ???
6984
$products = $cache->my_products;
7085
if($products == null) {
7186
$products = "object | array | function_get_products";

examples/debugging.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
class a {
4+
5+
function __construct() {
6+
return new b();
7+
}
8+
9+
function x() {
10+
echo " -> X";
11+
}
12+
}
13+
14+
class b {
15+
16+
function x() {
17+
echo " --> X2 ";
18+
}
19+
20+
function y() {
21+
echo " --> Y";
22+
}
23+
}
24+
25+
$a = new a();
26+
$a->x();
27+
28+

examples/testing.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
2+
echo $_SERVER['HOME'];
3+
print_r($_SERVER);
24

5+
exit;
36
$string = "ABC_KAJSHDKAS_AKDJASKDJSA_SAKDJHSKADJHS_19827381276318253_ASKDHKAJSHDKAJDHA_18973628137621";
47
$max = 999999;
58

phpfastcache.php

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
<?php
22
// phpFastCache Library
3-
require_once(dirname(__FILE__) . "/phpfastcache/2.4.2/base.php");
3+
require_once(dirname(__FILE__) . "/phpfastcache/3.0.0/phpfastcache.php");
44

55
// OK, setup your cache
6-
phpFastCache::$storage = "auto";
76
phpFastCache::$config = array(
8-
"storage" => phpFastCache::$storage,
9-
/*
10-
* Fall back when old driver is not support
11-
*/
12-
"fallback" => "files",
7+
"storage" => "auto", // auto, files, sqlite, apc, cookie, memcache, memcached, predis, redis, wincache, xcache
8+
"default_chmod" => 0777, // For security, please use 0666 for module and 0644 for cgi.
139

14-
"securityKey" => "auto",
10+
11+
/*
12+
* OTHERS
13+
*/
14+
15+
// create .htaccess to protect cache folder
16+
// By default the cache folder will try to create itself outside your public_html.
17+
// However an htaccess also created in case.
1518
"htaccess" => true,
19+
20+
// path to cache folder, leave it blank for auto detect
1621
"path" => "",
22+
"securityKey" => "auto", // auto will use domain name, set it to 1 string if you use alias domain name
23+
24+
// MEMCACHE
1725

1826
"memcache" => array(
1927
array("127.0.0.1",11211,1),
2028
// array("new.host.ip",11211,1),
2129
),
2230

31+
// REDIS
2332
"redis" => array(
2433
"host" => "127.0.0.1",
2534
"port" => "",
@@ -29,11 +38,18 @@
2938
),
3039

3140
"extensions" => array(),
41+
42+
43+
/*
44+
* Fall back when old driver is not support
45+
*/
46+
"fallback" => "files",
47+
3248
);
3349

3450

3551
// temporary disabled phpFastCache
3652
phpFastCache::$disabled = false;
3753

38-
// default chmod | only change if you know what you are doing
39-
phpFastCache::$default_chmod = ""; // keep it blank, it will use 666 for module and 644 for cgi
54+
55+

0 commit comments

Comments
 (0)