function clean($group = false)
{
if ($this->_fileNameProtection) {
$motif = $group ? 'cache_' . md5($group) . '_' : 'cache_';
} else {
$motif = $group ? 'cache_' . $group . '_' : 'cache_';
}
if ($this->_memoryCaching) {
while (list($key, $value) = each($this->_memoryCaching)) {
if (strpos($key, $motif, 0)) {
unset($this->_memoryCaching[$key]);
$this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
}
}
if ($this->_onlyMemoryCaching) {
return true;
}
}
if (!($dh = opendir($this->_cacheDir))) {
$this->raiseError('TCache_Lite : Unable to open cache directory !');
return false;
}
while ($file = readdir($dh)) {
if ($file != '.' && $file != '..') {
$file = $this->_cacheDir . $file;
if (is_file($file)) {
if (strpos($file, $motif, 0)) {
if (!@unlink($file)) {
$this->raiseError('Cache_Lite : Unable to remove cache !', -3);
return false;
}
}
}
}
}
return true;
}