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


PHP Smarty::clearCache方法代码示例

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


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

示例1: CacheExpire

 /**
  * Expires the cache
  *
  * @param boolean $expireAll expire the whole cache
  */
 public function CacheExpire($expireAll = false)
 {
     if ($expireAll) {
         $this->tpl->clearAllCache();
         return;
     }
     if (!$this->project) {
         return;
     }
     $epoch = $this->GetProject()->GetEpoch();
     if (empty($epoch)) {
         return;
     }
     $age = $this->GetProject()->GetAge();
     $this->tpl->clearCache(null, $this->GetCacheKeyPrefix(), null, $age);
     $this->tpl->clearCache('projectlist.tpl', $this->GetCacheKeyPrefix(false), null, $age);
 }
开发者ID:hmcclungiii,项目名称:gitphp,代码行数:22,代码来源:ControllerBase.class.php

示例2: clearCurrentCache

 public function clearCurrentCache()
 {
     $tpl = system::param("page");
     if ($tpl) {
         $tpl = "{$tpl}.tpl";
         if (system::param("templateBase")) {
             $tpl = "extends:" . system::param("templateBase") . "|{$tpl}";
         }
     } else {
         $tpl = null;
     }
     $cacheID = $this->getCacheID();
     if ($cacheID) {
         parent::clearCache(null, $cacheID);
     } else {
         parent::clearCache($tpl);
     }
 }
开发者ID:ygres,项目名称:sblog,代码行数:18,代码来源:class.tpl.php

示例3: clearCacheFiles

function clearCacheFiles(Smarty $smarty, $cache_id = 0, $table = '', $table_id = 0, $link = '')
{
    $cache_data = array();
    // Удаление файлов кэша по ID
    if ((int) $cache_id > 0) {
        $query = 'CALL get_table_row_by_id(:current_table, :id_value)';
        $params = array(':current_table' => PREF . 'cached_files', ':id_value' => $cache_id);
        $tmp = PdoWrap::select($query, $params);
        $cache_data = array_merge($cache_data, $tmp);
        $query = 'CALL delete_table_row_by_field(:current_table, :table_cell, :cell_value)';
        $params = array(':current_table' => PREF . 'cached_files', ':table_cell' => 'id', ':cell_value' => $cache_id);
        PdoWrap::execute($query, $params);
    }
    // Удаление файлов кэша по ID таблицы
    if (!empty($table) && (int) $table_id > 0) {
        $query = 'SELECT * FROM `' . PREF . 'cached_files` WHERE `table_name` = :table_name AND `table_id` = :table_id';
        $params = array(':table_name' => $table, ':table_id' => $table_id);
        $tmp = PdoWrap::select($query, $params);
        $cache_data = array_merge($cache_data, $tmp);
        $query = 'DELETE FROM `' . PREF . 'cached_files` WHERE `table_name` = :table_name AND `table_id` = :table_id';
        $params = array(':table_name' => $table, ':table_id' => $table_id);
        PdoWrap::execute($query, $params);
    }
    // Удаление файлов кэша по всей таблице
    if (!empty($table) && (int) $table_id == 0) {
        $query = 'SELECT * FROM `' . PREF . 'cached_files` WHERE `table_name` = :table_name';
        $params = array(':table_name' => $table);
        $tmp = PdoWrap::select($query, $params);
        $cache_data = array_merge($cache_data, $tmp);
        $query = 'DELETE FROM `' . PREF . 'cached_files` WHERE `table_name` = :table_name';
        $params = array(':table_name' => $table);
        PdoWrap::execute($query, $params);
    }
    // Удаление файлов кэша по ссылке
    if (!empty($link)) {
        $query = 'SELECT * FROM `' . PREF . 'cached_files` WHERE `link` LIKE :link';
        $params = array(':link' => '%' . $link . '%');
        $tmp = PdoWrap::select($query, $params);
        $cache_data = array_merge($cache_data, $tmp);
        $query = 'DELETE FROM `' . PREF . 'cached_files` WHERE `link` LIKE :link';
        $params = array(':link' => '%' . $link . '%');
        PdoWrap::execute($query, $params);
    }
    for ($i = 0; $i < count($cache_data); $i++) {
        $smarty->clearCache($cache_data[$i]['template'], $cache_data[$i]['id']);
    }
}
开发者ID:klimjr,项目名称:cms,代码行数:47,代码来源:functions_list.php

示例4: clearCache

 /**
  * Empty cache for a specific template
  *
  * This is just a pass-through wrapper with a warning since this method previously existed
  * only in XoopsTpl, but now is also a regular Smarty method.
  *
  * clearModuleCompileCache() is the replacement for the old clearCache
  *
  * @param  string  $template_name template name
  * @param  string  $cache_id      cache id
  * @param  string  $compile_id    compile id
  * @param  integer $exp_time      expiration time
  * @param  string  $type          resource type
  *
  * @return integer number of cache files deleted
  */
 public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
 {
     \Xoops::getInstance()->deprecated('XoopsTpl::clearCache() is potentially ambiguous');
     return parent::clearCache($template_name, $cache_id, $compile_id, $exp_time, $type);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:21,代码来源:XoopsTpl.php

示例5: check_template_invalidation

 /**
  * Handle the lazy template cache invalidation
  *
  * @param  string  $template template name
  * @param  string  $cache_id      cache id
  * @param  string  $compile_id    compile id
  */
 public function check_template_invalidation($template, $cache_id, $compile_id)
 {
     static $last_flush = null;
     if (!file_exists($this->getCacheDir() . 'last_template_flush')) {
         @touch($this->getCacheDir() . 'last_template_flush', time());
     } elseif (defined('_DB_PREFIX_')) {
         if ($last_flush === null) {
             $sql = 'SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `' . _DB_PREFIX_ . 'smarty_last_flush` WHERE type=\'template\'';
             $last_flush = Db::getInstance()->getValue($sql, false);
         }
         if ((int) $last_flush && @filemtime($this->getCacheDir() . 'last_template_flush') < $last_flush) {
             @touch($this->getCacheDir() . 'last_template_flush', time());
             parent::clearAllCache();
         } else {
             if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
                 $cache_id = null;
             }
             if ($this->is_in_lazy_cache($template, $cache_id, $compile_id) === false) {
                 // insert in cache before the effective cache creation to avoid nasty race condition
                 $this->insert_in_lazy_cache($template, $cache_id, $compile_id);
                 parent::clearCache($template, $cache_id, $compile_id);
             }
         }
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:32,代码来源:SmartyCustom.php

示例6: clear_cache

 public function clear_cache($template = null, $cache_id = null, $compile_id = null, $exp_time = null)
 {
     if (is_null($template)) {
         $template = CONTROLLER_NAME . '/' . ACTION_NAME . C('view_suffix');
     } elseif (strstr($template, '.')) {
         //直接使用模板路径
     } elseif (strstr($template, ':')) {
         $template = str_replace(':', '/', $template);
         $template = $template . C('view_suffix');
     } else {
         $template = CONTROLLER_NAME . '/' . $template . C('view_suffix');
     }
     return parent::clearCache($template, $cache_id, $compile_id, $exp_time);
 }
开发者ID:actcms,项目名称:frogphp,代码行数:14,代码来源:SmartyVendor.class.php

示例7: clearCache

 public function clearCache($template, $cache_id = null)
 {
     return $this->smarty->clearCache($template, $cache_id);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:4,代码来源:waSmarty3View.class.php

示例8: clearCache

 public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
 {
     $template_name .= '.tpl';
     $this->smarty->clearCache($template_name, $cache_id, $compile_id, $exp_time, $type);
 }
开发者ID:skullyframework,项目名称:skully,代码行数:5,代码来源:SmartyAdapter.php


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