當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cachemgr::set_modified方法代碼示例

本文整理匯總了PHP中cachemgr::set_modified方法的典型用法代碼示例。如果您正苦於以下問題:PHP cachemgr::set_modified方法的具體用法?PHP cachemgr::set_modified怎麽用?PHP cachemgr::set_modified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cachemgr的用法示例。


在下文中一共展示了cachemgr::set_modified方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: strtoupper

 function &exec($sql, $skipModifiedMark = false, $db_lnk = null)
 {
     if (!$skipModifiedMark && preg_match('/(?:(delete\\s+from)|(insert\\s+into)|(update))\\s+([]0-9a-z_:"`.@[-]*)/is', $sql, $match)) {
         $table = strtoupper(trim(str_replace('`', '', str_replace('"', '', str_replace("'", '', $match[4])))));
         $now = time();
         $this->exec('UPDATE sdb_base_cache_expires SET expire = "' . $now . '" WHERE type = "DB" AND name = "' . strtoupper($table) . '"', true);
         if ($this->affect_row()) {
             cachemgr::set_modified('DB', $table, $now);
         }
     }
     if (!is_resource($db_lnk)) {
         if ($this->_rw_lnk) {
             $db_lnk =& $this->_rw_lnk;
         } else {
             $db_lnk =& $this->_rw_conn();
         }
     }
     if ($this->prefix != 'sdb_') {
         $sql = preg_replace('/([`\\s\\(,])(sdb_)([a-z\\_]+)([`\\s\\.]{0,1})/is', "\${1}" . $this->prefix . "\\3\\4", $sql);
     }
     if ($rs = mysql_query($sql, $db_lnk)) {
         self::$mysql_query_executions++;
         $db_result = array('rs' => &$rs, 'sql' => $sql);
         return $db_result;
     } else {
         trigger_error($sql . ':' . mysql_error($db_lnk), E_USER_WARNING);
         return false;
     }
 }
開發者ID:dalinhuang,項目名稱:shopexts,代碼行數:29,代碼來源:connections.php

示例2: exec

 /**
  * 數據庫操作核心入口.
  *
  * @param $sql SQL語句
  * @param $skipModifiedMark 是否忽略緩存標記更新
  */
 public function exec($sql, $skipModifiedMark = false, $db_lnk = false, &$stmt = flase)
 {
     if ($this->prefix != 'vmc_') {
         $sql = preg_replace_callback('/([`\\s\\(,])(vmc_)([0-9a-z\\_]+)([`\\s\\.]{0,1})/is', array($this, 'fix_dbprefix'), $sql);
     }
     //刪除、插入、更新 語句
     if (preg_match('/(?:(delete\\s+from)|(insert\\s+into)|(update))\\s+([]0-9a-z_:"`.@[-]*)/is', $sql, $match)) {
         //直接操作主庫
         if (!$db_lnk) {
             $db_lnk = $this->_rw_lnk;
         }
         if (!$db_lnk) {
             $db_lnk = $this->_rw_lnk = $this->_rw_conn();
         }
         if (!$skipModifiedMark && cachemgr::enable()) {
             $table = strtoupper(trim(str_replace('`', '', str_replace('"', '', str_replace("'", '', $match[4])))));
             $now = time();
             $pos = strpos($table, strtoupper($this->prefix));
             if ($pos === 0) {
                 $table = substr($table, strlen($this->prefix));
             }
             $exec_count = $db_lnk->exec('UPDATE vmc_base_cache_expires SET expire = "' . $now . '" WHERE type = "DB" AND name = "' . $table . '"');
             if ($exec_count) {
                 //更新數據庫表緩存標記
                 cachemgr::set_modified('DB', $table, $now);
             }
         }
         logger::debug('EXEC SQL:' . $sql);
         // debug 2015/8/31
         $this->last_query = $sql;
         $this->array_query[] = $sql;
         $affected = $db_lnk->exec($sql);
         if ($affected === false) {
             $this->error = $error_info = $db_lnk->errorInfo();
             $this->error_code = $db_lnk->errorCode();
             logger::error('MYSQL_ERROR! SQL:' . $sql);
             logger::error('ERROR_CODE:' . $db_lnk->errorCode() . 'ERROR_INFO:' . implode('::', (array) $error_info));
             return false;
         }
         return true;
     } else {
         //查詢為主
         if ($this->_ro_lnk) {
             $db_lnk = $this->_ro_lnk;
         } else {
             $db_lnk = $this->_ro_conn();
         }
         logger::debug('QUERY SQL:' . $sql);
         $stmt = $db_lnk->query($sql);
         $db_res = array();
         while ($stmt && ($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
             $db_res[] = $row;
         }
         // debug 2015/8/31
         $this->last_query = $sql;
         $this->array_query[] = $sql;
         return array('rs' => $db_res, 'sql' => $sql);
     }
 }
開發者ID:noikiy,項目名稱:snk.com,代碼行數:65,代碼來源:mysql.php

示例3: exec

 public function exec($sql, $skipModifiedMark = false, $db_lnk = null)
 {
     if ($this->prefix != 'sdb_') {
         //$sql = preg_replace('/([`\s\(,])(sdb_)([a-z\_]+)([`\s\.]{0,1})/is',"\${1}".$this->prefix."\\3\\4",$sql);
         $sql = preg_replace_callback('/([`\\s\\(,])(sdb_)([0-9a-z\\_]+)([`\\s\\.]{0,1})/is', array($this, 'fix_dbprefix'), $sql);
         //todo: 兼容有特殊符號的表名前綴
     }
     if (!$skipModifiedMark && cachemgr::enable() && preg_match('/(?:(delete\\s+from)|(insert\\s+into)|(update))\\s+([]0-9a-z_:"`.@[-]*)/is', $sql, $match)) {
         $table = strtoupper(trim(str_replace('`', '', str_replace('"', '', str_replace("'", '', $match[4])))));
         $now = time();
         $pos = strpos($table, strtoupper($this->prefix));
         if ($pos === 0) {
             $table = substr($table, strlen($this->prefix));
         }
         //todo: 真實表名
         $this->exec('UPDATE sdb_base_cache_expires SET expire = "' . $now . '" WHERE type = "DB" AND name = "' . $table . '"', true);
         if ($this->affect_row()) {
             cachemgr::set_modified('DB', $table, $now);
         }
     }
     if (!is_resource($db_lnk)) {
         if ($this->_rw_lnk) {
             $db_lnk = $this->_rw_lnk;
         } else {
             $db_lnk = $this->_rw_conn();
         }
     }
     if (defined("STRESS_TESTING")) {
         b2c_forStressTest::$sqlAmount++;
         b2c_forStressTest::slowSqlStart();
     }
     if ($rs = mysql_query($sql, $db_lnk)) {
         if (defined("STRESS_TESTING")) {
             b2c_forStressTest::slowSqlEnd($sql);
         }
         self::$mysql_query_executions++;
         logger::debug('sql:' . self::$mysql_query_executions . '.' . $sql);
         $db_result = array('rs' => $rs, 'sql' => $sql);
         return $db_result;
     } else {
         logger::error($sql . ':' . mysql_error($db_lnk));
         trigger_error($sql . ':' . mysql_error($db_lnk), E_USER_WARNING);
         return false;
     }
 }
開發者ID:sss201413,項目名稱:ecstore,代碼行數:45,代碼來源:connections.php

示例4: set_modified

 public function set_modified($key)
 {
     $vary_name = strtoupper(md5($this->app_id . $key));
     cachemgr::set_modified('CONF', $vary_name, syscache::instance('setting')->set_last_modify());
 }
開發者ID:yindonghai,項目名稱:msk.com,代碼行數:5,代碼來源:app.php

示例5: set_modified

 public function set_modified($key)
 {
     $vary_name = strtoupper(md5($this->app_id . $key));
     $now = time();
     $db = kernel::database();
     $db->exec('REPLACE INTO sdb_base_cache_expires (`type`, `name`, `expire`) VALUES ("CONF", "' . $vary_name . '",' . $now . ')', true);
     if ($db->affect_row()) {
         cachemgr::set_modified('CONF', $vary_name, $now);
     }
 }
開發者ID:dalinhuang,項目名稱:shopexts,代碼行數:10,代碼來源:app.php

示例6: set_modified

 public function set_modified($key)
 {
     $vary_name = strtoupper(md5($this->app_id . $key));
     $now = time();
     $db = vmc::database();
     $exec_count = $db->exec('REPLACE INTO vmc_base_cache_expires (`type`, `name`, `app`, `expire`) VALUES ("CONF", "' . $vary_name . '", "' . $this->app_id . '", ' . $now . ')', true);
     if ($exec_count) {
         cachemgr::set_modified('CONF', $vary_name, $now);
         syscache::instance('setting')->set_last_modify();
     }
 }
開發者ID:noikiy,項目名稱:snk,代碼行數:11,代碼來源:app.php


注:本文中的cachemgr::set_modified方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。