芝麻web文件管理V1.00
编辑当前文件:/home/asmplong/www/ancien-site-2019/site/components/com_joomlawatch/class.joomlawatch.cache.php
database = new JoomlaWatchDB(); $this->helper = new JoomlaWatchHelper(); $this->config = new JoomlaWatchConfig(); } /** * cache */ function getCachedItem($key) { $time = $this->helper->getServerTime(); $query = sprintf("select cache, lastUpdate from #__joomlawatch_cache where `key` = '%s' limit 1", $this->database->getEscaped($key)); $rows = @ $this->database->objectListQuery($query); $row = @ $rows[0]; $cacheInterval = @ $this->config->getConfigValue('JOOMLAWATCH_'.$key); if ($time - @ $cacheInterval < @ $row->lastUpdate) { return @ $row->cache; } else { return false; } } /** * cache */ function storeCachedItem($key, $cache) { $query = sprintf("select cache, lastUpdate from #__joomlawatch_cache where `key` = '%s' limit 1", $this->database->getEscaped($key)); $rows = @ $this->database->objectListQuery($query); $row = @ $rows[0]; $time = $this->helper->getServerTime(); if (!@ $row->cache) { // insert $cache = addslashes($cache); $query = sprintf("insert into #__joomlawatch_cache (id, `key`, lastUpdate, cache) values ('','%s', '%d', '%s' )", $this->database->getEscaped($key), (int) $time, $this->database->getEscaped($cache)); $this->database->executeQuery($query); } else { $cache = addslashes($cache); $query = sprintf("update #__joomlawatch_cache set lastUpdate = '%d', cache = '%s' where `key` = '%s' limit 1", (int) $time, $this->database->getEscaped($cache), $this->database->getEscaped($key)); $this->database->executeQuery($query); } } /** * cache */ function clearCache() { $query = sprintf("delete from #__joomlawatch_cache"); $result1 = $this->database->executeQuery($query); } } ?>