Skip to content

Commit 812bd9d

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/4.0-dev' into final
2 parents 53241bf + eae2a5e commit 812bd9d

File tree

327 files changed

+467
-661
lines changed

Some content is hidden

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

327 files changed

+467
-661
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,8 @@ pip-log.txt
230230
#################
231231
## NetBeans
232232
#################
233-
nbproject/
233+
nbproject/
234+
235+
#Composer
236+
vendor/
237+
composer.lock

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=5.1.0"
17+
"php": ">=5.3.0"
1818
},
1919
"autoload": {
20-
"files": ["phpfastcache.php"]
20+
"psr-0": {
21+
"Phpfastcache": "src/"
22+
},
23+
"files": [
24+
"src/Phpfastcache/legacy/aliases.php"
25+
]
2126
}
2227
}

example.php renamed to examples/1.example.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
<?php
2-
32
/**
43
* Welcome to Learn Lesson
54
* This is very Simple PHP Code of Caching
65
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> http://www.phpfastcache.com
76
*/
87

9-
// Require Library
10-
require_once("phpfastcache.php");
8+
use Phpfastcache\core\InstanceManager;
9+
10+
// Include composer autoloader
11+
require '../vendor/autoload.php';
1112

12-
// simple Caching with:
13-
$cache = phpFastCache();
13+
$cache = InstanceManager::getInstance();
1414

15-
// Try to get $products from Caching First
16-
// product_page is "identity keyword";
17-
$products = $cache->get("product_page");
15+
/**
16+
* Try to get $products from Caching First
17+
* product_page is "identity keyword";
18+
*/
19+
$key = "product_page";
20+
$products = $cache->get($key);
1821

19-
if ($products == null) {
22+
if (is_null($products)) {
2023
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
2124
// Write products to Cache in 10 minutes with same keyword
22-
$cache->set("product_page", $products, 600);
25+
$cache->set($key, $products, 600);
2326

2427
echo " --> NO CACHE ---> DB | Func | API RUN FIRST TIME ---> ";
2528

2629
} else {
2730
echo " --> USE CACHE --> SERV 10,000+ Visitors FROM CACHE ---> ";
2831
}
2932

30-
// use your products here or return it;
33+
/**
34+
* use your products here or return it;
35+
*/
3136
echo $products;
3237

3338

examples/1.learn.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/100.list_of_functions.php

Lines changed: 0 additions & 80 deletions
This file was deleted.

examples/101.learn_fast.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

example2.php renamed to examples/2.example.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@
77
*/
88

99
// Require Library
10-
require_once("phpfastcache.php");
10+
use Phpfastcache\core\InstanceManager;
11+
use Phpfastcache\core\Phpfastcache;
12+
13+
// Include composer autoloader
14+
require '../vendor/autoload.php';
1115

1216
// simple Caching with:
13-
$cache = phpFastCache("redis");
17+
$cache = InstanceManager::getInstance("redis");
1418

1519
if ($cache->fallback === true) {
16-
echo " USE BACK UP DRIVER = " . phpFastCache::$config[ 'fallback' ] . " <br>";
20+
echo " USE BACK UP DRIVER = " . Phpfastcache::$config[ 'fallback' ] . " <br>";
1721
} else {
1822
echo ' DRIVER IS GOOD <br>';
1923
}
2024

25+
/**
26+
* Try to get $products from Caching First
27+
* product_page is "identity keyword";
28+
*/
29+
$key = "product_page2";
30+
$products = $cache->get($key);
2131

22-
// Try to get $products from Caching First
23-
// product_page is "identity keyword";
24-
$products = $cache->get("product_page2");
25-
26-
if ($products == null) {
32+
if (is_null($products)) {
2733
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
2834
// Write products to Cache in 10 minutes with same keyword
29-
$cache->set("product_page2", $products, 2);
35+
$cache->set($key, $products, 600);
3036

3137
echo " --> NO CACHE ---> DB | Func | API RUN FIRST TIME ---> ";
3238

examples/2.setup.php

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)