<?php
$cache = RayCache::getInstance('newest', null, array('prefix' => 'tribox_', 'path' => 'cache/', 'expire' => $setting['cachelife']));
$data = $cache->read('newest');
if ($data) {
	echo $data;
} else {
	$cache->start_caching();
?>
	<div class="navh3">Newest Games</div>
<div class="links1">
<?php
$query = yasDB_select("select * from games order by id desc limit 5",false);
while($row = $query->fetch_array(MYSQLI_ASSOC)) {
	$gameurl = $row['title'];
    $gameurl = str_replace(" ", "-", $gameurl);
    $gameurl = str_replace("'", "_", $gameurl);
    $gameurl = str_replace('"', "_", $gameurl);
	$gameurl = str_replace('/', "_", $gameurl);
    $gameurl = str_replace("\\", "_", $gameurl);
    $gameurl = rawurlencode($gameurl);
	if(strpos($row['description'], "'")) {
		$row['description'] = str_replace("'", "", $row['description']);
	}
	if ($setting['seo']=='yes') {
		echo'<a href="' . $setting['siteurl'] . 'game/' . $row['id'] . '/' . $gameurl . '.html' . '">' . $row['title'] . '</a>';
    } else {
		echo'<a href="' . $setting['siteurl'] . 'index.php?act=game&id=' . $row['id'] . '">' . $row['title'] . '</a>';
    }
}
$query->close();
?>                  
</div>
<?php
$cache->write('newest');
$cache->stop_caching();
echo $cache->read('newest');
}
?>