本文整理汇总了PHP中xcache_count函数的典型用法代码示例。如果您正苦于以下问题:PHP xcache_count函数的具体用法?PHP xcache_count怎么用?PHP xcache_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcache_count函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: clear
/**
* {@inheritdoc}
*/
public function clear()
{
$cleared = true;
// Set XCache password
$tempUsername = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : false;
$tempPassword = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : false;
$_SERVER['PHP_AUTH_USER'] = $this->username;
$_SERVER['PHP_AUTH_PW'] = $this->password;
// Clear Cache
$cacheCount = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $cacheCount; $i++) {
if (@xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
$cleared = false;
break;
}
}
// Reset PHP_AUTH username/password
if ($tempUsername !== false) {
$_SERVER['PHP_AUTH_USER'] = $tempUsername;
} else {
unset($_SERVER['PHP_AUTH_USER']);
}
if ($tempPassword !== false) {
$_SERVER['PHP_AUTH_PW'] = $tempPassword;
} else {
unset($_SERVER['PHP_AUTH_PW']);
}
// Return result
return $cleared;
}
开发者ID:rafaelharus,项目名称:framework,代码行数:33,代码来源:XCache.php
示例2: delete
public function delete($id, $tag = FALSE)
{
if ($tag !== FALSE) {
Kohana::log('error', 'Cache: tags are unsupported by the Xcache driver');
return TRUE;
} elseif ($id !== TRUE) {
if (xcache_isset($id)) {
return xcache_unset($id);
}
return FALSE;
} else {
// Do the login
$this->auth();
$result = TRUE;
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
if (xcache_clear_cache(XC_TYPE_VAR, $i) !== NULL) {
$result = FALSE;
break;
}
}
// Undo the login
$this->auth(TRUE);
return $result;
}
return TRUE;
}
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:26,代码来源:Xcache.php
示例3: clear
public function clear()
{
$admin = ini_get('xcache.admin.enable_auth') === "On";
if ($admin && (!isset($this->config['username']) || !isset($this->config['password']))) {
return false;
}
$credentials = array();
if (isset($_SERVER['PHP_AUTH_USER'])) {
$credentials['username'] = $_SERVER['PHP_AUTH_USER'];
$_SERVER['PHP_AUTH_USER'] = $this->config['username'];
}
if (isset($_SERVER['PHP_AUTH_PW'])) {
$credentials['password'] = $_SERVER['PHP_AUTH_PW'];
$_SERVER['PHP_AUTH_PW'] = $this->config['pass'];
}
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
return false;
}
}
if (isset($_SERVER['PHP_AUTH_USER'])) {
$_SERVER['PHP_AUTH_USER'] = $credentials['username'];
}
if (isset($_SERVER['PHP_AUTH_PW'])) {
$_SERVER['PHP_AUTH_PW'] = $credentials['password'];
}
return true;
}
开发者ID:pavlyshyn,项目名称:cache,代码行数:28,代码来源:XCache.php
示例4: driver_clean
function driver_clean($option = array())
{
$cnt = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $cnt; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
return true;
}
开发者ID:kvox,项目名称:TVSS,代码行数:8,代码来源:xcache.php
示例5: clean
/**
* Remove all keys and value from cache
*/
public function clean()
{
$cnt = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $cnt; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
return true;
}
开发者ID:mactronique,项目名称:phpcache,代码行数:11,代码来源:XcacheDriver.php
示例6: flush
public function flush()
{
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
return false;
}
}
return true;
}
开发者ID:Bob-586,项目名称:cx_old,代码行数:9,代码来源:xcache.php
示例7: clear_cache
private function clear_cache()
{
$_SERVER["PHP_AUTH_USER"] = "xcache";
$_SERVER["PHP_AUTH_PW"] = "xcache";
$xcache_count = xcache_count(XC_TYPE_VAR);
for ($cacheid = 0; $cacheid < $xcache_count; $cacheid++) {
xcache_clear_cache(XC_TYPE_VAR, $cacheid);
}
}
开发者ID:easthero,项目名称:kohana,代码行数:9,代码来源:auditevent.php
示例8: setUp
/**
* Clear the userspace cache
*
* @return void
*/
public function setUp()
{
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
return false;
}
}
$this->XCache = new XCache();
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:14,代码来源:XCacheTest.php
示例9: getStats
/**
* {@inheritDoc}
*/
public function getStats()
{
$size = 0;
for ($ii = 0, $max = xcache_count(XC_TYPE_VAR); $ii < $max; ++$ii) {
$block = xcache_list(XC_TYPE_VAR, $ii);
foreach ($block as $entries) {
$size += count($entries);
}
}
return array(CacheInterface::STATS_SIZE => $size);
}
开发者ID:Nyholm,项目名称:acache,代码行数:14,代码来源:XCacheCache.php
示例10: removeAll
/**
* remove all cache-items
*
* @return bool
*/
public function removeAll()
{
if (defined('XC_TYPE_VAR')) {
$xCacheCount = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $xCacheCount; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
return true;
}
return false;
}
开发者ID:voku,项目名称:simple-cache,代码行数:16,代码来源:AdapterXcache.php
示例11: purge
/**
* Purge cache data
*
* @return null
*/
function purge()
{
// Run before for XCache, if admin functions are disabled it will terminate execution
parent::purge();
// If the admin authentication is enabled but not set up, this will cause a nasty error.
// Not much we can do about it though.
$n = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $n; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
}
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:16,代码来源:acm_xcache.php
示例12: flush
public function flush()
{
$count = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $count; $i++) {
if (!xcache_clear_cache(XC_TYPE_VAR, $i)) {
return FALSE;
}
xcache_clear_cache(XC_TYPE_VAR, $i);
}
return TRUE;
}
开发者ID:Kami,项目名称:Multi-Storage-Cache,代码行数:11,代码来源:XCache.php
示例13: clean
public function clean()
{
$max_count = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $max_count; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
$max_count = xcache_count(XC_TYPE_PHP);
for ($i = 0; $i < $max_count; $i++) {
xcache_clear_cache(XC_TYPE_PHP, $i);
}
return;
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:12,代码来源:xcache.class.php
示例14: clear_all
/**
* Xcache缓存-清空所有缓存
* 不建议使用该功能
* @return
*/
public function clear_all()
{
$tmp['user'] = isset($_SERVER['PHP_AUTH_USER']) ? null : $_SERVER['PHP_AUTH_USER'];
$tmp['pwd'] = isset($_SERVER['PHP_AUTH_PW']) ? null : $_SERVER['PHP_AUTH_PW'];
$_SERVER['PHP_AUTH_USER'] = $this->authUser;
$_SERVER['PHP_AUTH_PW'] = $this->authPwd;
$max = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $max; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
$_SERVER['PHP_AUTH_USER'] = $tmp['user'];
$_SERVER['PHP_AUTH_PW'] = $tmp['pwd'];
return true;
}
开发者ID:peterlevel1,项目名称:haha-9,代码行数:19,代码来源:xcache.init.php
示例15: getCacheKeys
/**
* @return array
*/
public function getCacheKeys()
{
$this->checkAuth();
$keys = array();
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
$infos = xcache_list(XC_TYPE_VAR, $i);
if (is_array($infos['cache_list'])) {
foreach ($infos['cache_list'] as $info) {
$keys[] = substr($info['name'], strlen($this->getOption('prefix')));
}
}
}
return $keys;
}
开发者ID:uniteddiversity,项目名称:policat,代码行数:17,代码来源:sfXCacheTaggingCache.class.php
示例16: cs_cache_info
function cs_cache_info()
{
$form = array();
$cache_count = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $cache_count; $i++) {
$info = xcache_list(XC_TYPE_VAR, $i);
foreach ($info['cache_list'] as $num => $data) {
$handle = $data['name'] . ' (' . $i . '.' . $num . ')';
$form[$handle] = array('name' => $handle, 'time' => $data['ctime'], 'size' => $data['size']);
}
}
ksort($form);
return array_values($form);
}
开发者ID:aberrios,项目名称:WEBTHESGO,代码行数:14,代码来源:xcache.php
示例17: flush
/**
* Önbelleğe alınan tüm verileri siler
*
* @return mixed
*/
public function flush()
{
$count = xcache_count(XC_TYPE_PHP);
for ($i = 0; $i < $count; $i++) {
// XCache PHP cache temizle.
xcache_clear_cache(XC_TYPE_PHP, $i);
}
$count = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $count; $i++) {
// XCache degisken cache temizle.
xcache_clear_cache(XC_TYPE_VAR, $i);
}
return true;
}
开发者ID:AnonymPHP,项目名称:Anonym-Cache,代码行数:19,代码来源:XCacheDriver.php
示例18: getIds
/**
* {@inheritdoc}
*/
public function getIds()
{
$this->_checkAuth();
$keys = array();
for ($i = 0, $count = xcache_count(XC_TYPE_VAR); $i < $count; $i++) {
$entries = xcache_list(XC_TYPE_VAR, $i);
if (is_array($entries['cache_list'])) {
foreach ($entries['cache_list'] as $entry) {
$keys[] = $entry['name'];
}
}
}
return $keys;
}
开发者ID:manish436,项目名称:zform,代码行数:17,代码来源:XcacheCache.php
示例19: clear
public function clear($name = null)
{
if (function_exists('xcache_clear_cache') && function_exists('xcache_count')) {
$count = xcache_count(XC_TYPE_PHP);
for ($cache_id = 0; $cache_id < $count; $cache_id++) {
xcache_clear_cache(XC_TYPE_PHP, $cache_id);
}
}
if ($name === null) {
$this->data = array();
} else {
unset($this->data[$name]);
}
$this->save();
}
开发者ID:cretzu89,项目名称:EPESI,代码行数:15,代码来源:cache.php
示例20: flush
/**
* {@inheritdoc}
*/
public function flush()
{
$backup = ['PHP_AUTH_USER' => !empty($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '', 'PHP_AUTH_PW' => !empty($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''];
$auth = ['PHP_AUTH_USER' => $this->getConfig('username'), 'PHP_AUTH_PW' => $this->getConfig('password')];
// Set auth
$_SERVER = $auth + $_SERVER;
// Clear cache
$count = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $count; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
// Reset auth
$_SERVER = $backup + $_SERVER;
return true;
}
开发者ID:vpg,项目名称:titon.cache,代码行数:18,代码来源:XcacheStorage.php
注:本文中的xcache_count函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论