当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::clear方法代码示例

本文整理汇总了PHP中Cache::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::clear方法的具体用法?PHP Cache::clear怎么用?PHP Cache::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cache的用法示例。


在下文中一共展示了Cache::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSave

 /**
  * @covers Phossa\Config\Env\Environment::save()
  * @covers Phossa\Config\Env\Environment::get()
  * @covers Phossa\Config\Env\Environment::clear()
  */
 public function testSave()
 {
     $data = ['db' => ['dsn' => 'bingo']];
     $this->object->save($data);
     $this->assertEquals($data, $this->object->get());
     $this->object->clear();
     $this->assertFalse($this->object->get());
 }
开发者ID:phossa,项目名称:phossa-config,代码行数:13,代码来源:CacheTest.php

示例2: setPath

 /**
  * @param string $path
  * @return $this
  */
 public function setPath($path)
 {
     $last = substr($path, -1);
     if ($last === '/') {
         $path = substr($path, 0, -1);
     }
     $this->path = $path;
     $this->cache->clear();
     return $this;
 }
开发者ID:Rmtram,项目名称:XmlValidator,代码行数:14,代码来源:Config.php

示例3: __construct

 public function __construct()
 {
     $guid = pageArray(2);
     adminGateKeeper();
     $plugin = getEntity($guid);
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     if ($plugin->enable()) {
         new SystemMessage("Plugin Enabled");
         new Cache("enabled_plugins_", false, "site");
         new Cache("enabled_plugins_reversed", false, "site");
         Systemvariable::set("setup_complete", false);
         forward("admin/plugins");
     }
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     Admintab::deleteAll();
     $translations = getEntities(array("type" => "Translationentity"));
     if ($translations) {
         foreach ($translations as $translation) {
             $translation->delete();
         }
     }
     new SystemMessage("Your plugin can't be enabled.  Check requirements");
     forward("admin/plugins");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:30,代码来源:EnablePluginActionHandler.php

示例4: __construct

 public function __construct()
 {
     if (!pageArray(2)) {
         forward("admin/plugins");
     }
     $guid = pageArray(2);
     adminGateKeeper();
     $plugin = getEntity($guid);
     classGateKeeper($plugin, "Plugin");
     $plugin->status = "disabled";
     $plugin->save();
     Cache::clear();
     Cache::clear();
     Admintab::deleteAll();
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Systemvariable::set("setup_complete", false);
     $translations = getEntities(array("type" => "Translationentity"));
     if ($translations) {
         foreach ($translations as $translation) {
             $translation->delete();
         }
     }
     new SystemMessage("Your plugin has been disabled.");
     forward("admin/plugins");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:27,代码来源:DisablePluginActionHandler.php

示例5: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->ApiUserApplication);
     unset($this->testAppToken);
     Cache::clear();
     parent::tearDown();
 }
开发者ID:port80labs,项目名称:Boxmeup,代码行数:12,代码来源:ApiUserApplicationTest.php

示例6: view

 /**
  * Clears cache
  */
 public function view()
 {
     adminGateKeeper();
     Cache::clear();
     new SystemMessage("All caches have been cleared.");
     forward();
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:10,代码来源:ClearCachePageHandler.php

示例7: clear

 function clear($checkExpiry)
 {
     foreach ($this->settings['stack'] as $engine => $stack) {
         Cache::clear($checkExpiry, $engine);
     }
     return true;
 }
开发者ID:voidet,项目名称:super_stack,代码行数:7,代码来源:super_stack.php

示例8: clear_cache

 /**
  * function to clear all cache data
  * by default accessible only for admin
  *
  * @access Public
  * @return void
  */
 public function clear_cache()
 {
     $this->autoRender = false;
     Cache::clear();
     clearCache();
     $files = array();
     $files = array_merge($files, glob(CACHE . '*'));
     // remove cached css
     $files = array_merge($files, glob(CACHE . 'css' . DS . '*'));
     // remove cached css
     $files = array_merge($files, glob(CACHE . 'js' . DS . '*'));
     // remove cached js
     $files = array_merge($files, glob(CACHE . 'models' . DS . '*'));
     // remove cached models
     $files = array_merge($files, glob(CACHE . 'persistent' . DS . '*'));
     // remove cached persistent
     foreach ($files as $f) {
         if (is_file($f)) {
             unlink($f);
         }
     }
     if (function_exists('apc_clear_cache')) {
         apc_clear_cache();
         apc_clear_cache('user');
     }
     $this->set(compact('files'));
     $this->layout = 'ajax';
 }
开发者ID:Klaasie,项目名称:cakephp-twentywords,代码行数:35,代码来源:ToolsController.php

示例9: clear_cache

 function clear_cache()
 {
     Cache::clear(false, 'file');
     Cache::clear(false, 'long_term');
     $this->Session->setFlash(__('The cache has been cleared.', true), 'default', array('class' => 'success'));
     $this->redirect('/');
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:7,代码来源:all_controller.php

示例10: load

 public function load()
 {
     // Load config
     // Try from cache
     $cachekey = "config";
     if ($this->user) {
         $cachekey .= ":" . $this->user;
     }
     $this->config = Cache::load("config");
     if (!is_array($this->config) || $this->get('cache.active') != 1) {
         // Load config from database
         $sql = new SqlManager();
         if (!is_null($this->user)) {
             $sql->setQuery("SELECT * FROM config WHERE user_id = {{user}}");
             $sql->bindParam("{{user}}", $this->user);
         } else {
             $sql->setQuery("SELECT * FROM config WHERE user_id IS NULL");
         }
         $sql->execute();
         $this->config = array();
         while ($row = $sql->fetch()) {
             $this->config[$row['name']] = $row['value'];
         }
         if (!isset($this->config['cache.active']) || $this->config['cache.active'] != 1) {
             // If cache is deactivated, clear possible cache file
             Cache::clear($cachekey);
         } else {
             // If cache is activeated, save config for later use
             Cache::save($cachekey, $this->config);
         }
     }
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:32,代码来源:Config.php

示例11: afterSave

 /**
  * Called by Cake after every model is saved.  
  * This method clears the cache if we're saving to one of the specified models to check.
  *
  */
 function afterSave()
 {
     $check_models = array('Content', 'Template', 'Stylesheet', 'MicroTemplate', 'GlobalContentBlock');
     if (in_array($this->name, $check_models)) {
         Cache::clear();
     }
 }
开发者ID:risnandar,项目名称:testing,代码行数:12,代码来源:app_model.php

示例12: removeHandler

 /**
  *
  * @param string $file
  * @param string $event
  * @return mixed
  */
 public static function removeHandler($file, $event)
 {
     $file = DataBase::Current()->EscapeString($file);
     $event = DataBase::Current()->EscapeString($event);
     Cache::clear("eventmanager", "handler");
     return DataBase::Current()->Execute("DELETE FROM {'dbprefix'}events WHERE event = '" . $event . "' AND file = '" . $file . "'");
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:13,代码来源:eventmanager.php

示例13: save

 public static function save($code, $value, $lang = null)
 {
     // Save specific locale value by given key
     if (!$lang) {
         $lang = self::getLanguage();
     }
     // Check if locale already exists
     $sql = new SqlManager();
     $sql->setQuery("\n\t\t\tSELECT code FROM locale \n\t\t\tWHERE code = '{{code}}' \n\t\t\tAND language = {{lang}}\n\t\t\tLIMIT 1");
     $sql->bindParam('{{code}}', $code);
     $sql->bindParam('{{lang}}', $lang, "int");
     $check = $sql->result();
     $loc = array('code' => $sql->escape($code), 'language' => $sql->escape($lang, "int"), 'text' => $sql->escape($value), 'lastchanged' => DateManager::now());
     // Either update database or insert new entry for given locale
     if (!$check['code']) {
         $loc['created'] = DateManager::now();
         $sql->insert("locale", $loc);
     } else {
         $sql->update("locale", $loc);
     }
     // Refresh cache to make sure new locale entry will be used
     $cachekey = "locale:" . $lang;
     Cache::clear($cachekey);
     self::load($lang);
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:25,代码来源:Locale.php

示例14: beforeFilter

 /**
  * beforeFilter
  *
  * @access public
  * @return void
  */
 function beforeFilter()
 {
     Cache::clear(false, 'configuration');
     $this->set('title_for_layout', __('Upgrade', true));
     if (!class_exists('DATABASE_CONFIG')) {
         // not a valid installation
         $this->Session->setFlash(__('It seems you do not have a installation of iPeer. Please install it first!', true));
         $this->redirect('/install');
         return;
     } elseif (IS_INSTALLED) {
         // 2.x upgrade
         $sysp = ClassRegistry::init('SysParameter');
         if (null == $sysp->get('system.version', null)) {
             return;
         }
     }
     // 3.x and above upgrade, enable permission
     // Workaround to avoid loading the User model with an iPeer2 database.
     // If we tried loading iPeer3's User model with an iPeer2 database,
     // we'll get missing table errors.
     App::import('Model', 'User');
     $permission = array_filter(array('controllers', ucwords($this->params['plugin']), ucwords($this->params['controller']), $this->params['action']));
     if (!User::hasPermission(join('/', $permission))) {
         $this->Session->setFlash('Error: You do not have permission to access the page.');
         $this->redirect('/home');
     }
 }
开发者ID:eecian,项目名称:Team08-iPeer,代码行数:33,代码来源:upgrade_controller.php

示例15: display

 public function display()
 {
     $template = new Template();
     $template->load("plugin_changepassword_changepassword");
     $template->show_if('PASSWORD_WRONG', false);
     $template->show_if('SUCCESSFUL', false);
     $template->show_if('OLD_PASSWORD_WRONG', false);
     if (isset($_REQUEST['old_password']) && !empty($_REQUEST['old_password']) && is_string($_REQUEST['old_password']) && isset($_REQUEST['new_password']) && !empty($_REQUEST['new_password']) && is_string($_REQUEST['new_password']) && isset($_REQUEST['confirm_password']) && !empty($_REQUEST['confirm_password']) && is_string($_REQUEST['confirm_password'])) {
         $old_password = DataBase::Current()->EscapeString($_REQUEST['old_password']);
         $new_password = DataBase::Current()->EscapeString($_REQUEST['new_password']);
         $confirm_password = DataBase::Current()->EscapeString($_REQUEST['confirm_password']);
         if ($new_password != $confirm_password) {
             $template->show_if('PASSWORD_WRONG', true);
         } else {
             $password = DataBase::Current()->EscapeString(md5($new_password . Settings::getInstance()->get("salt")));
             $old_password = DataBase::Current()->EscapeString(md5($old_password . Settings::getInstance()->get("salt")));
             $db_password = DataBase::Current()->ReadField("SELECT `password` FROM `{'dbprefix'}user` WHERE `id` = '" . User::Current()->id . "'; ");
             if ($db_password && $db_password != null) {
                 if ($db_password != $old_password) {
                     $template->show_if('OLD_PASSWORD_WRONG', true);
                 } else {
                     DataBase::Current()->Execute("UPDATE `{'dbprefix'}user` SET `password` = '" . $password . "' WHERE `id` = '" . User::Current()->id . "'; ");
                     $template->show_if('SUCCESSFUL', true);
                     EventManager::raiseEvent("plugin_changepassword_change", array('old_password' => $old_password, 'new_password' => $password, 'userid' => User::Current()->id));
                     Cache::clear("tables", "userlist");
                 }
             } else {
                 //Der User ist nicht in der Datenbank aufgeführt.
             }
         }
     }
     $template->assign_var('ACTION', UrlRewriting::GetUrlByAlias($this->page->alias));
     echo $template->getCode();
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:34,代码来源:page.php


注:本文中的Cache::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。