本文整理汇总了PHP中Cache::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::remove方法的具体用法?PHP Cache::remove怎么用?PHP Cache::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanFolder
/**
* remove deleted files in $path from the cache
*
* @param string $path
*/
public function cleanFolder($path)
{
$cachedContent = $this->cache->getFolderContents($path);
foreach ($cachedContent as $entry) {
if (!$this->storage->file_exists($entry['path'])) {
$this->cache->remove($entry['path']);
}
}
}
示例2: renameFromStorage
/**
* Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
*
* @param \OC\Files\Storage\Storage $sourceStorage
* @param string $source
* @param string $target
*/
public function renameFromStorage(\OC\Files\Storage\Storage $sourceStorage, $source, $target)
{
if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
return;
}
$time = time();
$sourceCache = $sourceStorage->getCache($source);
$sourceUpdater = $sourceStorage->getUpdater();
$sourcePropagator = $sourceStorage->getPropagator();
if ($sourceCache->inCache($source)) {
if ($this->cache->inCache($target)) {
$this->cache->remove($target);
}
if ($sourceStorage === $this->storage) {
$this->cache->move($source, $target);
} else {
$this->cache->moveFromCache($sourceCache, $source, $target);
}
}
if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION)) {
// handle mime type change
$mimeType = $this->storage->getMimeType($target);
$fileId = $this->cache->getId($target);
$this->cache->update($fileId, ['mimetype' => $mimeType]);
}
$sourceCache->correctFolderSize($source);
$this->cache->correctFolderSize($target);
$sourceUpdater->correctParentStorageMtime($source);
$this->correctParentStorageMtime($target);
$this->updateStorageMTimeOnly($target);
$sourcePropagator->propagateChange($source, $time);
$this->propagator->propagateChange($target, $time);
}
示例3: release
/**
* Release the lock.
*
* @param string $key Key that should fit the lock
* @return boolean
*/
public function release($key)
{
if ($key != $this->getKey()) {
return false;
}
if (!empty($this->info)) {
$this->store->remove('lock:' . $this->name);
}
}
示例4: onScriptShutdown
public static function onScriptShutdown()
{
Cache::remove('memory');
if (!is_null($err = error_get_last()) && !in_array($err['type'], array(E_NOTICE, E_WARNING))) {
DB\dbQuery('UPDATE file_previews
SET `status` = 3
WHERE status = 2');
DB\commitTransaction();
}
}
示例5: rebuildCacheFor
public static function rebuildCacheFor($lang_id)
{
Cache::remove('language_' . $lang_id, true);
Logger::warning('Cache for language ' . $lang_id . ' removed');
Database::query("OPTIMIZE TABLE PREFIX_translations");
$keys = Database::fetchAll("SELECT\n id,\n name,\n (\n SELECT value\n FROM PREFIX_translations\n WHERE language_id = :lang\n AND key_id = tk.id\n ) AS value\n FROM PREFIX_translations_keys AS tk\n WHERE DATE(date_used) > :date", array('lang' => $lang_id, 'date' => date('Y-m-d', strtotime('7 days ago'))));
Logger::warning('Translations fetched');
foreach ($keys as $list) {
if (!empty($list['value'])) {
Cache::set('language_' . $lang_id, $list['name'], $list['value']);
}
}
Logger::warning('Translations set');
}
示例6: saveTheme
public function saveTheme($theme_id, $data)
{
$dataCheck = Database::fetchAll("SELECT name, create_date FROM PREFIX_builder_themes WHERE theme_id = :id", array('id' => $theme_id));
if (!is_array($data) || !count($data)) {
$theme_id = $this->addTheme($data['name']);
}
unset($data['name']);
foreach ($data as $key => $value) {
if (is_array($value)) {
$value = json_encode($value);
}
Database::query("DELETE FROM PREFIX_builder_themes_settings WHERE setting_name = :key AND theme_id = :id", array('key' => $key, 'id' => $theme_id));
Database::insert("PREFIX_builder_themes_settings", array('setting_name' => $key, 'setting_value' => $value, 'theme_id' => $theme_id));
}
Cache::remove('builder');
}
示例7: call
public function call()
{
$cacheEnabled = array_get($this->action, "cacheEnabled") && Config::item("application", "cache", true);
if ($cacheEnabled && ($data = Cache::get(URI::current()))) {
$headersEnd = strpos($data, "\n\n");
if ($headersEnd > 0) {
$headers = explode("\n", substr($data, 0, $headersEnd));
foreach ($headers as $header) {
header($header);
}
}
$data = substr($data, $headersEnd + 2);
return $data;
}
$response = $this->response();
if ($cacheEnabled) {
$headersList = implode("\n", headers_list());
Cache::save(URI::current(), $headersList . "\n\n" . $response, array_get($this->action, "cacheExpirationTime"));
} else {
Cache::remove(URI::current());
}
return $response;
}
示例8: remove
/**
* removes an entry from the cache
*
* @access public
* @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
* @param string serial
* @return mixed
*/
public function remove($serial)
{
$this->implementation->remove($serial);
}
示例9: cleanAllUsersCount
/**
* Clean getAllUsersCount() cache
*/
function cleanAllUsersCount()
{
$Cache = new Cache();
$Cache->lifeTime = 3600;
$Cache->prefix = 'statistic';
if ($Cache->check('cnt_registered_users')) {
$Cache->remove('cnt_registered_users');
}
}
示例10: isBlocked
/**
* Check if host is blocked.
* Returns 0 if unblockable.
*
* @param string $host
* @param boolean $attempt Increment attempts (bool) or attempt (int)
* @return boolean
*/
public function isBlocked($host = null, $attempt = false)
{
if (empty($this->loginAttempts)) {
return 0;
}
if (!isset($host)) {
$host = HTTP::getClientIP(HTTP::CONNECTED_CLIENT);
}
if (empty($host) || in_array($host, $this->unblockableHosts, true)) {
return 0;
}
if (!isset($this->storeAttemps)) {
if (!Cache::hasInstance()) {
return 0;
}
$this->storeAttemps = Cache::i();
} elseif (!$this->storeAttemps instanceof Cache) {
$this->storeAttemps = Cache::with($this->storeAttemps, array('overwrite' => true));
}
if (is_bool($attempt)) {
$attempt = (int) $this->storeAttemps->get("AUTH-login_attempts:{$host}") + 1;
}
if ($attempt) {
$this->storeAttemps->save("AUTH-login_attempts:{$host}", $attempt);
} else {
$this->storeAttemps->remove("AUTH-login_attempts:{$host}");
}
return $this->loginAttempts - $attempt < 0;
}
示例11: config
/**
Configure framework according to .ini file settings and cache
auto-generated PHP code to speed up execution
@param $_file string
@public
**/
public static function config($_file)
{
// Generate hash code for config file
$_hash = 'php.' . self::hashCode($_file);
$_cached = Cache::cached($_hash);
if ($_cached && filemtime($_file) < $_cached['time']) {
// Retrieve from cache
$_save = Cache::fetch($_hash);
} else {
if (!file_exists($_file)) {
// .ini file not found
self::$global['CONTEXT'] = $_file;
trigger_error(self::TEXT_Config);
return;
}
// Map sections to framework methods
$_map = array('global' => 'set', 'routes' => 'route', 'maps' => 'map');
// Read the .ini file
preg_match_all('/\\s*(?:\\[(.+?)\\]|(?:;.+?)?|(?:([^=]+)=(.+?)))(?:\\v|$)/s', file_get_contents($_file), $_matches, PREG_SET_ORDER);
$_cfg = array();
$_ptr =& $_cfg;
foreach ($_matches as $_match) {
if ($_match[1]) {
// Section header
if (!isset($_map[$_match[1]])) {
// Unknown section
self::$global['CONTEXT'] = $_section;
trigger_error(self::TEXT_Section);
return;
}
$_ptr =& $_cfg[$_match[1]];
} elseif ($_match[2]) {
$_csv = array_map(function ($_val) {
// Typecast if necessary
return is_numeric($_val) || preg_match('/^(TRUE|FALSE)\\b/i', $_val) ? eval('return ' . $_val . ';') : $_val;
}, str_getcsv($_match[3]));
// Convert comma-separated values to array
$_match[3] = count($_csv) > 1 ? $_csv : $_csv[0];
if (preg_match('/(.+?)\\[(.*?)\\]/', $_match[2], $_sub)) {
if ($_sub[2]) {
// Associative array
$_ptr[$_sub[1]][$_sub[2]] = $_match[3];
} else {
// Numeric-indexed array
$_ptr[$_sub[1]][] = $_match[3];
}
} else {
// Key-value pair
$_ptr[$_match[2]] = $_match[3];
}
}
}
ob_start();
foreach ($_cfg as $_section => $_pairs) {
$_func = $_map[$_section];
foreach ($_pairs as $_key => $_val) {
// Generate PHP snippet
echo 'F3::' . $_func . '(' . var_export($_key, TRUE) . ',' . ($_func == 'set' || !is_array($_val) ? var_export($_val, TRUE) : self::listArgs($_val)) . ');' . "\n";
}
}
$_save = ob_get_contents();
ob_end_clean();
// Compress and save to cache
Cache::store($_hash, $_save);
}
// Execute cached PHP code
eval($_save);
if (self::$global['ERROR']) {
// Remove from cache
Cache::remove($_hash);
}
}
示例12: check_cache
/**
*缓存检查
*/
public function check_cache()
{
//缓存路径
$this->cache_path = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '/' . $_SERVER['REAL_REQUEST_URI'];
if (isset($_SERVER['YYUC_RENEW'])) {
Cache::remove($this->cache_path . '_key');
Redirect::to($_SERVER['YYUC_RENEW']);
return false;
}
$res = Cache::get($this->cache_path . '_key');
if (Conf::$is_developing || empty($res)) {
return false;
} else {
$lines = explode('@YYUC@', $res);
$access_m = true;
if (count($lines) > 1) {
//数据库缓存
$dbs = explode(',', $lines[1]);
foreach ($dbs as $db) {
if (Cache::has('YYUC_TABLE_TIME' . Conf::$db_tablePrefix . $db) && intval(Cache::get('YYUC_TABLE_TIME' . Conf::$db_tablePrefix . $db)) >= intval($lines[0])) {
//如果某一库表的更新时间大于等于缓存时间
return false;
}
}
if (isset($lines[2]) && !empty($lines[2])) {
$access_m = $lines[2];
}
} else {
//'@'则没有前置校验
$access_m = $res == '@' ? true : $res;
}
$this->html = Cache::get($this->cache_path);
return $access_m;
}
}
示例13: array_delete
public static function array_delete($name, $module_name = 'config')
{
Cache::remove($name, $module_name);
}
示例14: ajax
public function ajax()
{
$this->load->model('design/sumobuilder');
if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['action'])) {
$theme_id = isset($this->request->post['theme_id']) ? $this->request->post['theme_id'] : 1;
$response = array();
switch ($this->request->post['action']) {
case 'pages':
$this->data['settings'] = $this->model_design_sumobuilder->getTheme($theme_id);
if (isset($this->session->data['builder_' . $theme_id])) {
foreach ($this->session->data['builder_' . $theme_id] as $key => $value) {
$this->data['settings'][$key] = $value;
}
}
$this->load->model('localisation/language');
$this->data['languages'] = $this->model_localisation_language->getLanguages();
$this->load->model('catalog/information');
$pages = $this->model_catalog_information->getInformations();
$this->load->model('setting/store');
$stores = $this->model_settings_stores->getStores();
$this->data['stores'][0] = $this->config->get('name');
foreach ($stores as $list) {
$this->data['stores'][$list['store_id']] = $list['name'];
}
foreach ($pages as $list) {
$list['title'] = $this->data['stores'][$list['store_id']] . ': ' . $list['title'];
$this->data['pages'][] = $list;
}
$this->data['icons'] = $this->model_design_sumobuilder->getIcons(true);
$this->template = 'design/sumobuilder/pages.tpl';
return $this->response->setOutput($this->render());
break;
case 'backgrounds':
// RC3/V1
break;
case 'colors':
$this->data['settings'] = $this->model_design_sumobuilder->getTheme($theme_id);
if (isset($this->session->data['builder_' . $theme_id])) {
foreach ($this->session->data['builder_' . $theme_id] as $key => $value) {
$this->data['settings'][$key] = $value;
}
}
$this->template = 'design/sumobuilder/colors.tpl';
return $this->response->setOutput($this->render());
break;
case 'fonts':
$this->data['settings'] = $this->model_design_sumobuilder->getTheme($theme_id);
if (isset($this->session->data['builder_' . $theme_id])) {
foreach ($this->session->data['builder_' . $theme_id] as $key => $value) {
$this->data['settings'][$key] = $value;
}
}
$this->data['fonts'] = $this->model_design_sumobuilder->getFonts();
$this->template = 'design/sumobuilder/fonts.tpl';
return $this->response->setOutput($this->render());
break;
case 'custom':
$this->data['settings'] = $this->model_design_sumobuilder->getTheme($theme_id);
if (isset($this->session->data['builder_' . $theme_id])) {
foreach ($this->session->data['builder_' . $theme_id] as $key => $value) {
$this->data['settings'][$key] = $value;
}
}
$this->template = 'design/sumobuilder/custom.tpl';
return $this->response->setOutput($this->render());
break;
case 'save':
$this->data['token'] = $this->session->data['token'];
$this->template = 'design/sumobuilder/save.tpl';
return $this->response->setOutput($this->render());
break;
case 'save_as':
$new_theme_id = $this->model_design_sumobuilder->addTheme($this->request->post['name']);
if (!$new_theme_id) {
$response['result'] = Language::getVar('SUMO_ADMIN_DESIGN_SUMOBUILDER_SAVE_ERROR_NAME_IN_USE');
} else {
$this->session->data['builder_' . $theme_id]['lastmodified'] = time();
$this->session->data['builder_' . $theme_id]['theme_id'] = $new_theme_id;
$this->model_design_sumobuilder->saveTheme($new_theme_id, $this->session->data['builder_' . $theme_id]);
$this->session->data['builder_' . $theme_id] = $this->model_design_sumobuilder->getTheme($theme_id);
$this->session->data['builder_' . $new_theme_id] = $this->model_design_sumobuilder->getTheme($new_theme_id);
$this->createStylesheet($this->session->data['builder_' . $new_theme_id], $new_theme_id);
$response['result'] = 'OK';
Cache::remove('builder', true);
}
break;
case 'absolutesave':
$this->session->data['builder_' . $theme_id]['lastmodified'] = time();
$this->session->data['builder_' . $theme_id]['theme_id'] = $theme_id;
$this->model_design_sumobuilder->saveTheme($theme_id, $this->session->data['builder_' . $theme_id]);
$this->session->data['builder_' . $theme_id] = $this->model_design_sumobuilder->getTheme($theme_id);
$this->createStylesheet($this->session->data['builder_' . $theme_id], $theme_id);
$response['saved'] = 'true';
Cache::remove('builder', true);
break;
case 'midsave':
if (isset($this->request->post['data'])) {
$tmp = array();
parse_str(str_replace('amp;', '', $this->request->post['data']), $tmp);
$response['data'] = $tmp;
//.........这里部分代码省略.........
示例15: deleteGeoZone
public function deleteGeoZone($geo_zone_id)
{
$this->db->query("DELETE FROM " . DB_PREFIX . "geo_zone WHERE geo_zone_id = '" . (int) $geo_zone_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $geo_zone_id . "'");
Cache::remove('geo_zone');
}