Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

this is my main query in index.php file

and i try cache this query with phpfastcache ( http://www.phpfastcache.com/ )

$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

but i dont know how can i insert my query in this cache class?

sorry for bad english

share|improve this question
add comment

closed as off-topic by Joseph the Dreamer, Jamal Mar 1 at 19:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question must contain working code for us to review it here. For questions regarding specific problems encountered while coding, try Stack Overflow. After getting your code to work, you may edit this question seeking a review of your working code." – Joseph the Dreamer, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.