1
這是我在index.php文件主查詢如何使用phpfastcache?
我試圖用phpfastcache
$shorting = $conn->prepare("SELECT text,time FROM small WHERE active='0' ORDER BY time DESC LIMIT 10");
$shorting->execute();
while($obj = $shorting->fetch(PDO::FETCH_OBJ)){
<div id="lastnews_title">
<div><?php echo $obj->text; ?></div>
<div style="text-align:left">
<?php echo timeTonow($obj->time); ?>
</div>
這個緩存此查詢是phpfastcache網站爲例
// Require Library
require_once("../phpfastcache/phpfastcache.php");
// simple Caching with:
$cache = phpFastCache();
// Try to get $products from Caching First
// product_page is "identity keyword";
$products = $cache->get("product_page");
if($products == null) {
$products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS";
// Write products to Cache in 10 minutes with same keyword
$cache->set("product_page",$products , 600);
}
// use your products here or return it;
echo $products;
我在寫require_once("../phpfastcache/phpfastcache.php");
我的index.php
我不知道如何插入我的查詢在這個緩存類?
遺憾的英語不好