Skip to content

Commit 26f5527

Browse files
committed
Merge pull request #181 from Geolim4/issue-177
Issue 177
2 parents 54e5a61 + 4af9226 commit 26f5527

File tree

19 files changed

+2148
-1281
lines changed

19 files changed

+2148
-1281
lines changed

example.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

3-
/*
3+
/**
44
* Welcome to Learn Lesson
55
* This is very Simple PHP Code of Caching
6+
* @author Khoa Bui (khoaofgod) <[email protected]> http://www.phpfastcache.com
67
*/
78

89
// Require Library
@@ -15,15 +16,15 @@
1516
// product_page is "identity keyword";
1617
$products = $cache->get("product_page");
1718

18-
if($products == null) {
19-
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
20-
// Write products to Cache in 10 minutes with same keyword
21-
$cache->set("product_page",$products , 600);
19+
if ($products == null) {
20+
$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);
2223

23-
echo " --> NO CACHE ---> DB | Func | API RUN FIRST TIME ---> ";
24+
echo " --> NO CACHE ---> DB | Func | API RUN FIRST TIME ---> ";
2425

2526
} else {
26-
echo " --> USE CACHE --> SERV 10,000+ Visitors FROM CACHE ---> ";
27+
echo " --> USE CACHE --> SERV 10,000+ Visitors FROM CACHE ---> ";
2728
}
2829

2930
// use your products here or return it;

example2.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

3-
/*
3+
/**
44
* Welcome to Learn Lesson
55
* This is very Simple PHP Code of Caching
6+
* @author Khoa Bui (khoaofgod) <[email protected]> http://www.phpfastcache.com
67
*/
78

89
// Require Library
@@ -11,31 +12,30 @@
1112
// simple Caching with:
1213
$cache = phpFastCache("redis");
1314

14-
if($cache->fallback === true) {
15-
echo " USE BACK UP DRIVER = ".phpFastCache::$config['fallback']." <br>";
15+
if ($cache->fallback === true) {
16+
echo " USE BACK UP DRIVER = " . phpFastCache::$config[ 'fallback' ] . " <br>";
1617
} else {
17-
echo ' DRIVER IS GOOD <br>';
18+
echo ' DRIVER IS GOOD <br>';
1819
}
1920

2021

21-
2222
// Try to get $products from Caching First
2323
// product_page is "identity keyword";
2424
$products = $cache->get("product_page2");
2525

26-
if($products == null) {
27-
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
28-
// Write products to Cache in 10 minutes with same keyword
29-
$cache->set("product_page2",$products , 2);
26+
if ($products == null) {
27+
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
28+
// Write products to Cache in 10 minutes with same keyword
29+
$cache->set("product_page2", $products, 2);
3030

31-
echo " --> NO CACHE ---> DB | Func | API RUN FIRST TIME ---> ";
31+
echo " --> NO CACHE ---> DB | Func | API RUN FIRST TIME ---> ";
3232

3333
} else {
34-
echo " --> USE CACHE --> SERV 10,000+ Visitors FROM CACHE ---> ";
34+
echo " --> USE CACHE --> SERV 10,000+ Visitors FROM CACHE ---> ";
3535
}
3636

3737
// use your products here or return it;
38-
echo "Products = ".$products;
38+
echo "Products = " . $products;
3939

4040

4141

0 commit comments

Comments
 (0)