function xCacheFlush($sql = false, $inputarr = false) { global $ADODB_CACHE_DIR; if (!$this->cacheSecs) { return; } if ($this->memCache) { global $ADODB_INCLUDED_MEMCACHE; $key = false; if (empty($ADODB_INCLUDED_MEMCACHE)) { include ADODB_DIR . '/adodb-memcache.lib.inc.php'; } if ($sql) { $key = $this->_gencachename($sql . serialize($inputarr), false, true); } FlushMemCache($key, $this->memCacheHost, $this->memCachePort, $this->debug); return; } if (strlen($ADODB_CACHE_DIR) > 1 && !$sql) { if (strncmp(PHP_OS, 'WIN', 3) === 0) { $cmd = 'del /s ' . str_replace('/', '\\', $ADODB_CACHE_DIR) . '\\adodb_*.cache'; } else { //$cmd = 'find "'.$ADODB_CACHE_DIR.'" -type f -maxdepth 1 -print0 | xargs -0 rm -f'; $cmd = 'rm -rf ' . $ADODB_CACHE_DIR . '/[0-9a-f][0-9a-f]/'; // old version 'rm -f `find '.$ADODB_CACHE_DIR.' -name adodb_*.cache`'; } if ($this->debug) { ADOConnection::outp("CacheFlush: {$cmd}<br><pre>\n", system($cmd), "</pre>"); } else { exec($cmd); } return; } global $ADODB_INCLUDED_CSV; if (empty($ADODB_INCLUDED_CSV)) { include ADODB_DIR . '/adodb-csvlib.inc.php'; } $f = $this->_gencachename($sql . serialize($inputarr), false); adodb_write_file($f, ''); // is adodb_write_file needed? if (!@unlink($f)) { if ($this->debug) { ADOConnection::outp("CacheFlush: failed for {$f}"); } } }
/** * Flush cached recordsets that match a particular $sql statement. * If $sql == false, then we purge all files in the cache. */ function CacheFlush($sql = false, $inputarr = false) { global $ADODB_CACHE_DIR; if ($this->memCache) { global $ADODB_INCLUDED_MEMCACHE; $key = false; if (empty($ADODB_INCLUDED_MEMCACHE)) { include ADODB_DIR . '/adodb-memcache.lib.inc.php'; } if ($sql) { $key = $this->_gencachename($sql . serialize($inputarr), false, true); } FlushMemCache($key, $this->memCacheHost, $this->memCachePort, $this->debug); return; } if (strlen($ADODB_CACHE_DIR) > 1 && !$sql) { /*if (strncmp(PHP_OS,'WIN',3) === 0) $dir = str_replace('/', '\\', $ADODB_CACHE_DIR); else */ $dir = $ADODB_CACHE_DIR; if ($this->debug) { ADOConnection::outp("CacheFlush: {$dir}<br><pre>\n", $this->_dirFlush($dir), "</pre>"); } else { $this->_dirFlush($dir); } return; } global $ADODB_INCLUDED_CSV; if (empty($ADODB_INCLUDED_CSV)) { include ADODB_DIR . '/adodb-csvlib.inc.php'; } $f = $this->_gencachename($sql . serialize($inputarr), false); adodb_write_file($f, ''); // is adodb_write_file needed? if (!@unlink($f)) { if ($this->debug) { ADOConnection::outp("CacheFlush: failed for {$f}"); } } }