本文整理汇总了PHP中xcache_list函数的典型用法代码示例。如果您正苦于以下问题:PHP xcache_list函数的具体用法?PHP xcache_list怎么用?PHP xcache_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcache_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: driver_stats
function driver_stats($option = array())
{
$res = array("info" => "", "size" => "", "data" => "");
try {
$res['data'] = xcache_list(XC_TYPE_VAR, 100);
} catch (Exception $e) {
$res['data'] = array();
}
return $res;
}
示例2: 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);
}
示例3: clean
public function clean($group, $mode = null)
{
$allinfo = xcache_list(XC_TYPE_VAR, 0);
$keys = $allinfo['cache_list'];
$secret = $this->_hash;
foreach ($keys as $key) {
if (strpos($key['name'], $secret . '-cache-' . $group . '-') === 0 xor $mode != 'group') {
xcache_unset($key['name']);
}
}
return true;
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}
示例7: clear
/**
* {@inheritDoc}
*/
public function clear()
{
$this->lastModified = time();
// iterate over all entries and match the group prefix
$groupPrefix = $this->group . '/';
for ($ii = 0, $max = xcache_count(XC_TYPE_VAR); $ii < $max; ++$ii) {
$block = xcache_list(XC_TYPE_VAR, $ii);
foreach ($block as $entries) {
foreach ($entries as $entry) {
if (0 === strpos($entry['name'], $groupPrefix)) {
xcache_unset($entry['name']);
}
}
}
}
return true;
}
示例8: flush
/**
* Flush the cache.
*/
function flush()
{
$prefix = INDEX_FILE_LOCATION . ':' . $this->getContext() . ':' . $this->getCacheId();
if (function_exists('xcache_unset_by_prefix')) {
// If possible, just flush the context
xcache_unset_by_prefix(prefix);
} else {
// Otherwise, we need to do this manually
for ($i = 0; $i < xcache_count(XC_TYPE_VAR); $i++) {
$cache = xcache_list(XC_TYPE_VAR, $i);
foreach ($cache['cache_list'] as $entry) {
if (substr($entry['name'], 0, strlen($prefix)) == $prefix) {
xcache_unset($entry['name']);
}
}
}
}
}
示例9: getCacheInfo
public function getCacheInfo($key)
{
$this->checkAuth();
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) {
if ($this->getOption('prefix') . $key == $info['name']) {
return $info;
}
}
}
}
return null;
}
示例10: driver_stats
/**
* @param array $option
* @return array
*/
public function driver_stats($option = array())
{
$res = array('info' => '', 'size' => '', 'data' => '');
try {
$res['data'] = xcache_list(XC_TYPE_VAR, 100);
} catch (Exception $e) {
$res['data'] = array();
}
return $res;
}
示例11: clean
/**
* Clean cache for a group given a mode.
*
* group mode : cleans all cache in the group
* notgroup mode : cleans all cache not in the group
*
* @access public
* @param string $group The cache data group
* @param string $mode The mode for cleaning cache [group|notgroup]
* @return boolean True on success, false otherwise
* @since 1.5
*/
function clean($group, $mode)
{
if (!ini_get('xcache.admin.enable_auth')) {
$allinfo = xcache_list(XC_TYPE_VAR, 0);
$keys = $allinfo['cache_list'];
$secret = $this->_hash;
foreach ($keys as $key) {
if (strpos($key['name'], $secret . '-cache-' . $group . '-' . $this->_site) === 0 xor $mode != 'group') {
xcache_unset($key['name']);
}
}
return true;
}
return false;
}
示例12: internalGetMetadata
/**
* Get metadata of an item.
*
* @param string $normalizedKey
* @return array|bool Metadata on success, false on failure
* @throws Exception\ExceptionInterface
*/
protected function internalGetMetadata(&$normalizedKey)
{
$options = $this->getOptions();
$namespace = $options->getNamespace();
$prefix = $namespace === '' ? '' : $namespace . $options->getNamespaceSeparator();
$internalKey = $prefix . $normalizedKey;
if (xcache_isset($internalKey)) {
$this->initAdminAuth();
$cnt = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $cnt; $i++) {
$list = xcache_list(XC_TYPE_VAR, $i);
foreach ($list['cache_list'] as &$metadata) {
if ($metadata['name'] === $internalKey) {
$this->normalizeMetadata($metadata);
return $metadata;
}
}
}
$this->resetAdminAuth();
}
return false;
}
示例13: getIDs
/**
* Get all the cache ids
*
* @return array
*/
public function getIDs()
{
if (empty($this->_ids)) {
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) {
$this->_ids[] = str_replace(array($this->_prefix, $this->_suffix), '', $entry['name']);
}
}
}
}
return $this->_ids;
}
示例14: clean
/**
* Clean cache for a group provided.
*
* @param string $group The cache data group, passed '*' indicate all cache removal
*
* @return boolean
*
* @since 1.2.7
*/
public function clean($group)
{
$group = trim($group);
if (!$group) {
return false;
}
$cache_info = xcache_list(XC_TYPE_VAR, 0);
$keys = $cache_info['cache_list'];
foreach ($keys as $key) {
if ($group == '*' || strpos($key['name'], $this->secret . '-cache-' . $group . '.') === 0) {
xcache_unset($key['name']);
}
}
return true;
}
示例15: all
/**
* Get all cached data
*
* This requires the php.ini setting xcache.admin.enable_auth = Off.
*
* @return array
*/
public function all()
{
$hash = $this->options['hash'];
$allinfo = xcache_list(XC_TYPE_VAR, 0);
$data = array();
foreach ($allinfo['cache_list'] as $key) {
$namearr = explode('-', $key['name']);
if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') {
$group = $namearr[2];
if (!isset($data[$group])) {
$item = new Auditor($group);
} else {
$item = $data[$group];
}
$item->tally($key['size'] / 1024);
$data[$group] = $item;
}
}
return $data;
}