• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP memcache_close函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: displayWarningMessages


//.........这里部分代码省略.........
         if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] == '') {
             $url = 'install/index.php?redirect_url=index.php' . urlencode('?TYPO3_INSTALL[type]=config#set_encryptionKey');
             $warnings['install_encryption'] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_encryption'), '<a href="' . $url . '">', '</a>');
         }
         // Check if parts of fileDenyPattern were removed which is dangerous on Apache
         $defaultParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', FILE_DENY_PATTERN_DEFAULT, TRUE);
         $givenParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'], TRUE);
         $result = array_intersect($defaultParts, $givenParts);
         if ($defaultParts !== $result) {
             $warnings['file_deny_pattern'] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_deny_pattern_partsNotPresent'), '<br /><pre>' . htmlspecialchars(FILE_DENY_PATTERN_DEFAULT) . '</pre><br />');
         }
         // Check if fileDenyPattern allows to upload .htaccess files which is dangerous on Apache
         if ($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] != FILE_DENY_PATTERN_DEFAULT && \TYPO3\CMS\Core\Utility\GeneralUtility::verifyFilenameAgainstDenyPattern('.htaccess')) {
             $warnings['file_deny_htaccess'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_deny_htaccess');
         }
         // Check if there are still updates to perform
         if (!\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version(TYPO3_branch)) {
             $url = 'install/index.php?redirect_url=index.php' . urlencode('?TYPO3_INSTALL[type]=update');
             $warnings['install_update'] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_update'), '<a href="' . $url . '">', '</a>');
         }
         // Check if sys_refindex is empty
         $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_refindex');
         $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
         $lastRefIndexUpdate = $registry->get('core', 'sys_refindex_lastUpdate');
         if (!$count && $lastRefIndexUpdate) {
             $url = 'sysext/lowlevel/dbint/index.php?&id=0&SET[function]=refindex';
             $warnings['backend_reference'] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_reference_index'), '<a href="' . $url . '">', '</a>', self::dateTime($lastRefIndexUpdate));
         }
         // Check for memcached if configured
         $memCacheUse = FALSE;
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $table => $conf) {
                 if (is_array($conf)) {
                     foreach ($conf as $key => $value) {
                         if (!is_array($value) && $value === 'TYPO3\\CMS\\Core\\Cache\\Backend\\MemcachedBackend') {
                             $servers = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$table]['options']['servers'];
                             $memCacheUse = TRUE;
                             break;
                         }
                     }
                 }
             }
             if ($memCacheUse) {
                 $failed = array();
                 $defaultPort = ini_get('memcache.default_port');
                 if (function_exists('memcache_connect')) {
                     if (is_array($servers)) {
                         foreach ($servers as $testServer) {
                             $configuredServer = $testServer;
                             if (substr($testServer, 0, 7) == 'unix://') {
                                 $host = $testServer;
                                 $port = 0;
                             } else {
                                 if (substr($testServer, 0, 6) === 'tcp://') {
                                     $testServer = substr($testServer, 6);
                                 }
                                 if (strstr($testServer, ':') !== FALSE) {
                                     list($host, $port) = explode(':', $testServer, 2);
                                 } else {
                                     $host = $testServer;
                                     $port = $defaultPort;
                                 }
                             }
                             $memcache_obj = @memcache_connect($host, $port);
                             if ($memcache_obj != NULL) {
                                 memcache_close($memcache_obj);
                             } else {
                                 $failed[] = $configuredServer;
                             }
                         }
                     }
                 }
                 if (count($failed) > 0) {
                     $warnings['memcached'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.memcache_not_usable') . '<br/>' . implode(', ', $failed);
                 }
             }
         }
         // Hook for additional warnings
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $classRef) {
                 $hookObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
                 if (method_exists($hookObj, 'displayWarningMessages_postProcess')) {
                     $hookObj->displayWarningMessages_postProcess($warnings);
                 }
             }
         }
         if (count($warnings)) {
             if (count($warnings) > 1) {
                 $securityWarnings = '<ul><li>' . implode('</li><li>', $warnings) . '</li></ul>';
             } else {
                 $securityWarnings = '<p>' . implode('', $warnings) . '</p>';
             }
             $securityMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $securityWarnings, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.header'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
             $content = '<div style="margin: 20px 0px;">' . $securityMessage->render() . '</div>';
             unset($warnings);
             return $content;
         }
     }
     return '<p>&nbsp;</p>';
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:101,代码来源:BackendUtility.php


示例17: __destruct

 public function __destruct()
 {
     if (is_resource($this->memcache)) {
         memcache_close($this->memcache);
     }
 }
开发者ID:glzaboy,项目名称:fastlib,代码行数:6,代码来源:sae.php


示例18: close

 /**
  * 关闭内存连接
  *
  */
 public function close()
 {
     memcache_close($this->memcache);
 }
开发者ID:shampeak,项目名称:ap.so,代码行数:8,代码来源:Mmc2.php


示例19: close

 static function close(&$conn)
 {
     if (!is_array($conn)) {
         return false;
     }
     if ($conn[1] == 'mongo') {
         try {
             return $conn[0]->close();
         } catch (Exception $e) {
             $conn[4] = array($e->getCode(), $e->getMessage());
             return false;
         }
     } else {
         if ($conn[1] == 'memcache') {
             return @memcache_close($conn[0]);
         } else {
             if (stripos($conn[1], "pdo_") === 0) {
                 return is_object($conn[0]) && @$conn[0]->close();
             } else {
                 return @mysqli_close($conn[0]);
             }
         }
     }
 }
开发者ID:dws-bijaya,项目名称:PHP_Ezy_Query,代码行数:24,代码来源:tgr_db.class.php


示例20: output

 /**
  *	输出运算
  *   Filename	连载编译输出文件名
  */
 function output($Filename = '')
 {
     switch ($this->RunType) {
         //Mem编译模式
         case 'MemCache':
             if ($Filename == 'include_page') {
                 //直接输出文件
                 return $this->reader($this->FileDir[$this->ThisFile] . $this->ThisFile);
             } else {
                 $FileNames = $Filename ? $Filename : $this->ThisFile;
                 $CacheFile = $this->FileName($FileNames, $this->TplID);
                 //检测记录时间
                 $updateT = memcache_get($this->Emc, $CacheFile . '_date');
                 $update = $this->FileUpdate($CacheFile, $updateT);
                 $CacheData = memcache_get($this->Emc, $CacheFile);
                 if (trim($CacheData) && $update) {
                     //获得列表文件
                     unset($ks, $vs);
                     preg_match_all('/<\\!-- ET\\_inc\\_cache\\[(.+?)\\] -->/', $CacheData, $IncFile);
                     if (is_array($IncFile[1])) {
                         foreach ($IncFile[1] as $ks => $vs) {
                             $this->IncList[] = $vs;
                             $listDate = memcache_get($this->Emc, $vs . '_date');
                             echo @filemtime($this->TemplateDir . $vs) . ' - ' . $listDate . '<br>';
                             //更新inc缓存
                             if (@filemtime($this->TemplateDir . $vs) > $listDate) {
                                 $update = 1;
                                 $this->inc($vs);
                             }
                         }
                         //更新数据
                         if ($update == 1) {
                             $CacheData = $this->ParseCode($this->FileList, $Filename);
                             //cache date
                             @memcache_set($this->Emc, $CacheFile . '_date', time()) or die("Failed to save data at the server.");
                             @memcache_set($this->Emc, $CacheFile, $CacheData) or die("Failed to save data at the server.");
                         }
                     }
                     //Close
                     memcache_close($this->Emc);
                     return $CacheData;
                 } else {
                     if ($Filename) {
                         $CacheData = $this->ParseCode($this->FileList, $Filename);
                         //cache date
                         @memcache_set($this->Emc, $CacheFile . '_date', time()) or die("Failed to save data at the server.");
                         @memcache_set($this->Emc, $CacheFile, $CacheData) or die("Failed to save data at the server.");
                         //Close
                         memcache_close($this->Emc);
                         return $CacheData;
                     } else {
                         $CacheData = $this->ParseCode();
                         //cache date
                         @memcache_set($this->Emc, $CacheFile . '_date', time()) or die("Failed to save data at the server.");
                         @memcache_set($this->Emc, $CacheFile, $CacheData) or die("Failed to save data at the server2");
                         //Close
                         memcache_close($this->Emc);
                         return $CacheData;
                     }
                 }
             }
             break;
             //编译模式
         //编译模式
         case 'Cache':
             if ($Filename == 'include_page') {
                 //直接输出文件
                 return $this->reader($this->FileDir[$this->ThisFile] . $this->ThisFile);
             } else {
                 $FileNames = $Filename ? $Filename : $this->ThisFile;
                 $CacheFile = $this->FileName($FileNames, $this->TplID);
                 $CacheFile = $this->FileUpdate($CacheFile);
                 if (@is_file($CacheFile)) {
                     @extract($this->Value());
                     ob_start();
                     ob_implicit_flush(0);
                     include $CacheFile;
                     //获得列表文件
                     if ($EaseTemplate3_Cache != '') {
                         unset($ks, $vs);
                         preg_match_all('/<\\!-- ET\\_inc\\_cache\\[(.+?)\\] -->/', $EaseTemplate3_Cache, $IncFile);
                         if (is_array($IncFile[1])) {
                             foreach ($IncFile[1] as $ks => $vs) {
                                 $this->IncList[] = $vs;
                                 //更新inc缓存
                                 if (@filemtime($this->TemplateDir . $vs) > @filemtime($this->CacheDir . $this->TplID . $vs . '.' . $this->Language . '.php')) {
                                     $this->inc($vs);
                                 }
                             }
                         }
                         @eval('echo "' . $EaseTemplate3_Cache . '";');
                         $contents = ob_get_contents();
                         ob_end_clean();
                         return $contents;
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:anLl,项目名称:Apply2,代码行数:101,代码来源:template.core.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP memcache_delete函数代码示例发布时间:2022-05-15
下一篇:
PHP memcache_add_server函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap