Beispiel #1
0
 * Cache for 1 day (86400 seconds), group B
 */
$rs = $db->CachePGetAll(86400, 'SELECT * FROM Country WHERE Continent = ?', 'Europe', 'group:B');
echo count($rs), PHP_EOL;
$timer->setMark('86400');
/**
 * Cache for 1 hour (default), group C
 */
$rs = $db->CachePGetAll('SELECT * FROM Country WHERE Population <= ?', 100000, 'group:C');
echo count($rs), PHP_EOL;
$timer->setMark('default');
/**
 * lazy connection test query DB only when needed
 */
$db->debug();
$db->closeConnection();
/**
 * Cache for 5 minutes, group A
 */
$rs = $db->CachePGetAll('SELECT * FROM Country WHERE Region = ?', 'Caribbean');
echo count($rs), PHP_EOL;
$timer->setMark('lazy');
/**
 * flush only group A
 */
$db->CacheFlush('group:A');
/**
 * Cache for 5 minutes, group A
 */
$rs = $db->CachePGetAll(300, 'SELECT * FROM Country WHERE Region = ?', 'Caribbean', 'group:A');
echo count($rs), PHP_EOL;