<?
// include class
require_once('cache.php');
// create object
$cache = new Cache();
// checking the existence of the cache
$data = $cache->read('test_17.tmp'); //17 this example id of article
// if cache doesn't exist get article from database
if (empty($data)) {
$sql = "SELECT image, user_id, content FROM table WHERE id = 17";
$data = $db->select_list($sql); // just for example
$cache->write('test_17.tmp', $data);
}
// next use data what always
foreach($data as $row) {
........
}