this is my main query in index.php file
I am trying to cache this query with 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>
this is an example in phpfastcache site
// 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;
I write require_once("../phpfastcache/phpfastcache.php");
in my index.php
I dont know how to insert my query in this cache class?
sorry for bad english