示例#1
0
 /**
  * @desc   WHAT?
  * @author xing39393939@gmail.com
  * @since  2012-11-29 18:13:14
  * @throws 注意:无DB异常处理
  */
 function delete($key)
 {
     $bool = false;
     if ($this->config['host']) {
         if ($this->memcacheObj || $this->connect()) {
             $t1 = microtime(true);
             try {
                 $bool = $this->memcacheObj->delete($key);
             } catch (Exception $e) {
                 _status(1, VHOST . '(Couchbase)', '异常', "{$this->config['host_alias']}:{$this->config['bucket']}(delete)", $key, VIP, GET_INCLUDED_FILES);
             }
             $diff_time = sprintf('%.5f', microtime(true) - $t1);
             _status(1, VHOST . '(Couchbase)', "{$this->config['host_alias']}:{$this->config['bucket']}(delete)", GET_INCLUDED_FILES, NULL, VIP, $diff_time);
             if ($diff_time < 1) {
                 _status(1, VHOST . '(Couchbase)', '一秒内', _debugtime($diff_time), "{$this->config['host_alias']}:{$this->config['bucket']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             } else {
                 _status(1, VHOST . '(Couchbase)', '超时', _debugtime($diff_time), "{$this->config['host_alias']}:{$this->config['bucket']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             }
         }
     } else {
         if (strpos(get_class($this), 'memcache_server') !== false) {
             $this->connect($key);
         }
         if ($this->memcacheObj) {
             $t1 = microtime(true);
             $bool = $this->memcacheObj->delete($key, 0);
             $diff_time = sprintf('%.5f', microtime(true) - $t1);
             _status(1, VHOST . '(Memcache)', "{$this->current_host['host']}:{$this->current_host['port']}(delete)", GET_INCLUDED_FILES, NULL, VIP, $diff_time);
             if ($diff_time < 1) {
                 _status(1, VHOST . '(Memcache)', '一秒内', _debugtime($diff_time), "{$this->current_host['host']}:{$this->current_host['port']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             } else {
                 _status(1, VHOST . '(Memcache)', '超时', _debugtime($diff_time), "{$this->current_host['host']}:{$this->current_host['port']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             }
         }
         //mysql中删除;
         if (!$this->mysql_conn && $this->mysql_config) {
             $this->mysql_conn = _mysqllogon($this->mysql_config['db_config']);
             if ($this->mysql_config['encode']) {
                 mysql_query("SET NAMES '{$this->mysql_config['encode']}'");
             }
         }
         if (!$this->mysql_conn) {
             return $bool;
         }
         $sql = "delete from  {$this->mysql_config['table_name']} where mem_key=:mem_key";
         $stmt = _mysqlparse($this->mysql_conn, $sql);
         _mysqlbindbyname($stmt, ":mem_key", $key);
         _mysqlexecute($stmt);
     }
     return $bool;
 }
示例#2
0
 function ociparse($conn_db, $sql)
 {
     $GLOBALS['$stmt'] = _mysqlparse($conn_db, $sql);
     return $conn_db;
 }