本文整理汇总了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;
}
}
示例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);
}
}
示例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;
}
}
示例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());
}
示例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);
}
}
示例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();
}
}