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


PHP memcache_close函数代码示例

本文整理汇总了PHP中memcache_close函数的典型用法代码示例。如果您正苦于以下问题:PHP memcache_close函数的具体用法?PHP memcache_close怎么用?PHP memcache_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: db_mysqli_query_fetch_list

function db_mysqli_query_fetch_list($mysqli, $query, $MYSQLI_TYPE)
{
    $config = getConfig();
    $params = $config['memcache'];
    $memcache = memcache_connect($params['host'], $params['port']);
    $memcacheQueryKey = 'QUERY' . $query['slow'];
    $data = memcache_get($memcache, $memcacheQueryKey);
    if (!empty($data)) {
    } else {
        if (!empty($query['fast'])) {
            $result = mysqli_query($mysqli, $query['fast']);
        } else {
            $result = mysqli_query($mysqli, $query['slow']);
        }
        $data = [];
        while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
            $data[] = $row;
        }
        //another proc
        /* $pid = pcntl_fork();
           if ($pid == 0) {*/
        memcache_set($memcache, $memcacheQueryKey, $data, 0, 60 * 10);
        /*    posix_kill(posix_getpid(), SIGTERM);
              }*/
    }
    memcache_close($memcache);
    return $data;
}
开发者ID:fedotovaleksandr,项目名称:vkTest,代码行数:28,代码来源:db_mysqli_query_fetch_list.php

示例2: __destruct

 public function __destruct()
 {
     // if we were connected, close the connection again
     if (is_resource($this->connection)) {
         memcache_close($this->connection);
     }
 }
开发者ID:jkinner,项目名称:ringside,代码行数:7,代码来源:CacheMemcache.php

示例3: disconnect

 static function disconnect()
 {
     if (CGlobal::$memcache_connect_id) {
         memcache_close(CGlobal::$memcache_connect_id);
     }
     return TRUE;
 }
开发者ID:hqd276,项目名称:bigs,代码行数:7,代码来源:eb_memcache.php

示例4: cache_delete

function cache_delete($key, $timeout = 0)
{
    $connection = cache_connect();
    $res = memcache_delete($connection, (string) $key, (int) $timeout);
    memcache_close($connection);
    return $res;
}
开发者ID:smarty-kiki,项目名称:frame,代码行数:7,代码来源:cache.php

示例5: tearDown

 public function tearDown()
 {
     if ($this->mmcError) {
         return;
     }
     memcache_close($this->mmc);
     $this->mmc = null;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:8,代码来源:jkvdb.memcache.html_cli.php

示例6: setUp

 public function setUp()
 {
     if ($this->mmcError) {
         return;
     }
     if (isset($this->conf['servers'])) {
         list($this->mmhost, $this->mmport) = explode(":", $this->conf['servers']);
     }
     $mmc = memcache_connect($this->mmhost, (int) $this->mmport);
     memcache_flush($mmc);
     memcache_close($mmc);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:12,代码来源:jcache.memcache.html_cli.php

示例7: changeCountItemsById

function changeCountItemsById($id, $val)
{
    $config = getConfig();
    $params = $config['memcache'];
    $table = ['name' => 'item', 'dbname' => 'db_vktest', 'as' => 'i'];
    $mysqli = db_mysqli_connect($table['dbname']);
    $queryUpdate = 'UPDATE store SET countitems = countitems + ' . intval($val) . ' WHERE idstore = ' . intval($id);
    $resultUpdate = mysqli_query($mysqli, $queryUpdate);
    db_mysqli_close($mysqli);
    $memcache = memcache_connect($params['host'], $params['port']);
    memcache_flush($memcache);
    memcache_close($memcache);
}
开发者ID:fedotovaleksandr,项目名称:vkTest,代码行数:13,代码来源:changeCountItemsById.php

示例8: afterLictAction

function afterLictAction($queryAssoc, $rowStore)
{
    $config = getConfig();
    /**
     * Count of items page,that need be cached,because
     * but last-1/-2/-3/-4 use slow query
     */
    $COUNT_BEFORE_END = 5;
    $length = $queryAssoc['query']['length'];
    $itemsLast = $rowStore['countitems'] % $length;
    $lastPage = $rowStore['countitems'] - $itemsLast;
    $start = $queryAssoc['query']['start'];
    /**
     * only for last page
     */
    if ($start == $lastPage) {
        //last 5 page in cache&
        $queryCheckPre = array_merge($queryAssoc, []);
        $queryCheckPre['query']['start'] = $start - 1 * $length;
        $queryPre = buildListItemQuery($queryCheckPre, $rowStore['countitems']);
        $params = $config['memcache'];
        $memcache = memcache_connect($params['host'], $params['port']);
        $memcacheQueryKey = 'QUERY' . $queryPre['slow'];
        $data = memcache_get($memcache, $memcacheQueryKey);
        memcache_close($memcache);
        //another proc
        if (empty($data)) {
            $pid = pcntl_fork();
            if ($pid == 0) {
                $mysqli = db_mysqli_connect($queryAssoc['table']['dbname']);
                for ($i = 1; $i < $COUNT_BEFORE_END; $i++) {
                    $queryAssoc['query']['start'] = $start - $i * $length;
                    $sqlQueryes = buildListItemQuery($queryAssoc, $rowStore['countitems']);
                    $rows = db_mysqli_query_fetch_list($mysqli, $sqlQueryes, MYSQLI_ASSOC);
                    $_SESSION['list'] = ['lastitem' => $rows[count($rows) - 1], 'firstitem' => $rows[0], 'lastpage' => $queryAssoc['query']['start'], 'slowQueryType' => $sqlQueryes['slowQueryType']];
                    //
                    usleep(500);
                }
                db_mysqli_close($mysqli);
                exit(0);
                //end new proc
            }
        }
    }
}
开发者ID:fedotovaleksandr,项目名称:vkTest,代码行数:45,代码来源:afterListAction.php

示例9: test

 function test()
 {
     global $memcache_test_servers;
     if (!extension_loaded('memcache') || !class_exists('Memcache')) {
         return FALSE;
     }
     if (empty($memcache_test_servers)) {
         return TRUE;
     }
     // Note: will return true if at least one connection succeeds
     foreach ($memcache_test_servers as $memcache_server_info) {
         if ($memcache_obj = memcache_connect($memcache_server_info['host'], $memcache_server_info['port'])) {
             memcache_close($memcache_obj);
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:rahulsiwal,项目名称:younity,代码行数:18,代码来源:memcache.php

示例10: db_mysqli_query_fetch_store

function db_mysqli_query_fetch_store($mysqli, $query, $MYSQLI_TYPE)
{
    $config = getConfig();
    $params = $config['memcache'];
    $memcache = memcache_connect($params['host'], $params['port']);
    $memcacheQueryKey = 'QUERY' . md5($query);
    $data = memcache_get($memcache, $memcacheQueryKey);
    if (!empty($data)) {
    } else {
        $result = mysqli_query($mysqli, $query);
        $data = [];
        while ($row = mysqli_fetch_array($result, $MYSQLI_TYPE)) {
            $data[] = $row;
        }
        memcache_set($memcache, $memcacheQueryKey, $data, 0, 60 * 10);
    }
    memcache_close($memcache);
    return $data;
}
开发者ID:fedotovaleksandr,项目名称:vkTest,代码行数:19,代码来源:db_mysqli_query_fetch_store.php

示例11: __destruct

 function __destruct()
 {
     memcache_close($this->connection);
 }
开发者ID:wangxian,项目名称:ePHP,代码行数:4,代码来源:Cache.class.php

示例12: push

	function push($device_token,$message){
	  $memcache_obj = memcache_connect('192.168.133.71',21211);
	  while(list($key,$deviceToken) = each($device_token)){
            
	  if($data['payload']=$message){
	      $data['deviceToken']=$deviceToken;
              $output = json_encode($data);
              memcache_set($memcache_obj,'pushqueue',$output,0,0);
	    } 
	  }
	  memcache_close($memcache_obj);
	}
开发者ID:nard,项目名称:Pushchat-Server,代码行数:12,代码来源:apns.php

示例13: mkdir

 public function mkdir($path, $mode, $options)
 {
     $path = trim(substr($path, 8));
     //echo "回调mkdir\n";
     $path = rtrim($path, '/');
     $this->stat = $this->get_file_info($path);
     $this->stat['ctime'] = $this->stat[10] = time();
     $this->stat['mode'] = $this->stat[2] = $this->dir_mode;
     //echo "生成新的stat数据" . print_r( $this->stat , 1 );
     memcache_set($this->mc(), $path . '.meta', serialize($this->stat));
     //echo "写入MC. key= " . $path.'.meta ' .  memcache_get( $this->mc , $path.'.meta'  );
     memcache_close($this->mc);
     return true;
 }
开发者ID:ysking,项目名称:commlib,代码行数:14,代码来源:sae_functions.php

示例14: disconnect

 /**
  * Disconnect from remote cache store
  *
  * @access	public
  * @return	boolean		Disconnect successful
  */
 public function disconnect()
 {
     if ($this->link) {
         return memcache_close($this->link);
     }
     return false;
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:13,代码来源:classCacheMemcache.php

示例15: memcache_connect

<?php

$memcache = memcache_connect('10.10.20.93', 11211);
//$memcache = @memcache_connect('localhost', 11211);
try {
    if ($memcache) {
        echo '{"error_code":"0","error_string":"SUCCESS"}';
        memcache_close($memcache);
    } else {
        echo '{"error_code":"1","error_string":"Connection to memcached failed"}';
    }
} catch (Exception $ex) {
    echo '{"error_code":"1","error_string":"' . $ex->getMessage() . '"}';
}
开发者ID:ngothanhduoc,项目名称:wap_tao,代码行数:14,代码来源:memcached.php


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