public function flushCacheExpired($force = false)
{
$interval = $this->getFlushInterval();
if (!$force && $interval === 0) {
return;
}
$key = 'TDbCache:' . $this->_cacheTable . ':flushed';
$now = time();
$next = $interval + (int) $this->getApplication()->getGlobalState($key, 0);
if ($force || $next <= $now) {
if (!$this->_cacheInitialized) {
$this->initializeCache();
}
Prado::trace(($force ? 'Force flush of expired items: ' : 'Flush expired items: ') . $this->id . ', ' . $this->_cacheTable, '\\Prado\\Caching\\TDbCache');
$sql = 'DELETE FROM ' . $this->_cacheTable . ' WHERE expire<>0 AND expire<' . $now;
$this->getDbConnection()->createCommand($sql)->execute();
$this->getApplication()->setGlobalState($key, $now);
}
}