本文整理汇总了PHP中wincache_ucache_info函数的典型用法代码示例。如果您正苦于以下问题:PHP wincache_ucache_info函数的具体用法?PHP wincache_ucache_info怎么用?PHP wincache_ucache_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wincache_ucache_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: status
public function status()
{
$status = wincache_ucache_info(true);
$return['缓存命中'] = $status['total_hit_count'];
$return['缓存未命中'] = $status['total_miss_count'];
return $return;
}
示例2: _getCacheKeys
/**
* Fetch an array of all keys stored in cache
*
* @return array Returns the array of cache keys
*/
protected function _getCacheKeys()
{
$ci = wincache_ucache_info();
$keys = array();
foreach ($ci['ucache_entries'] as $entry) {
$keys[] = $entry['key_name'];
}
return $keys;
}
示例3: gc
public function gc()
{
$allinfo = wincache_ucache_info();
$keys = $allinfo['cache_entries'];
$secret = $this->_hash;
foreach ($keys as $key) {
if (strpos($key['key_name'], $secret . '-cache-')) {
wincache_ucache_get($key['key_name']);
}
}
}
示例4: cs_cache_info
function cs_cache_info()
{
$form = array();
$info = wincache_ucache_info();
foreach ($info['ucache_entries'] as $num => $data) {
$handle = $data['key_name'] . ' (' . $num . ')';
$age = time() - $data['age_seconds'];
$form[$handle] = array('name' => $handle, 'time' => $age, 'size' => $data['value_size']);
}
ksort($form);
return array_values($form);
}
示例5: keys
/**
* @return Array
*/
public function keys()
{
$info = wincache_ucache_info();
$list = $info['ucache_entries'];
$keys = array();
if (is_null($list)) {
return array();
}
foreach ($list as $entry) {
$keys[] = $entry['key_name'];
}
return $keys;
}
示例6: clear
/**
* Delete all keys from the cache
*
* @param bool $check if true will check expiration, otherwise delete all
* @return bool True if the cache was successfully cleared, false otherwise
*/
public function clear($check)
{
if ($check) {
return true;
}
$info = wincache_ucache_info();
$cacheKeys = $info['ucache_entries'];
unset($info);
foreach ($cacheKeys as $key) {
wincache_ucache_delete($key['key_name']);
}
return true;
}
示例7: filter
public function filter($prefix)
{
$prefixLen = strlen($prefix);
$info = wincache_ucache_info();
$keysToDelete = array();
foreach ($info['ucache_entries'] as $entry) {
if (empty($entry['is_session']) && 0 === strncmp($entry['key_name'], $prefix, $prefixLen)) {
$keysToDelete[] = $entry['key_name'];
}
}
if ($keysToDelete) {
wincache_ucache_delete($keysToDelete);
}
return true;
}
示例8: getIterator
/**
* Retrieve an external iterator
*
* Returns an external iterator.
*
* @param string|null $filter A PCRE regular expression.
* Only matching keys will be iterated over.
* Setting this to NULL matches all keys of this instance.
* @param bool $keysOnly Whether to return only the keys,
* or return both the keys and values.
*
* @return ArrayObject An array with all matching keys as array keys,
* and values as array values. If $keysOnly is TRUE, the array keys are
* numeric, and the array values are key names.
*/
public function getIterator($filter = null, $keysOnly = false)
{
$info = wincache_ucache_info();
$result = array();
foreach ($info['ucache_entries'] as $entry) {
if (!$entry['is_session'] && 0 === strpos($entry['key_name'], $this->persistentId)) {
$localKey = strstr($entry['key_name'], $this->persistentId);
if (null === $filter || preg_match($filter, $localKey)) {
if ($keysOnly) {
$result[] = $localKey;
} else {
$result[$localKey] = apc_fetch($localKey);
}
}
}
}
return new ArrayObject($result);
}
示例9: stats
function stats()
{
echo "<p>\n";
foreach ($this->stats as $stat => $n) {
echo "<strong>{$stat}</strong> {$n}";
echo "<br/>\n";
}
echo "</p>\n";
echo "<h3>WinCache:</h3>";
foreach ($this->group_ops as $group => $ops) {
if (!isset($_GET['debug_queries']) && 500 < count($ops)) {
$ops = array_slice($ops, 0, 500);
echo "<big>Too many to show! <a href='" . add_query_arg('debug_queries', 'true') . "'>Show them anyway</a>.</big>\n";
}
echo "<h4>{$group} commands</h4>";
echo "<pre>\n";
$lines = array();
foreach ($ops as $op) {
$lines[] = $this->colorize_debug_line($op);
}
print_r($lines);
echo "</pre>\n";
}
if ($this->debug) {
$wincache_info = wincache_ucache_info();
echo "<p>";
echo "<strong>Cache Hits:</strong> {$wincache_info['total_hit_count']}<br/>\n";
echo "<strong>Cache Misses:</strong> {$wincache_info['total_miss_count']}\n";
echo "</p>\n";
}
}
示例10: 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;
$info = wincache_ucache_info(true, $internalKey);
if (isset($info['ucache_entries'][1])) {
$metadata = $info['ucache_entries'][1];
$this->normalizeMetadata($metadata);
return $metadata;
}
return false;
}
示例11: reset
/**
* Clear contents of cache backend
* @return bool
* @param $suffix string
* @param $lifetime int
**/
function reset($suffix = NULL, $lifetime = 0)
{
if (!$this->dsn) {
return TRUE;
}
$regex = '/' . preg_quote($this->prefix . '.', '/') . '.+?' . preg_quote($suffix, '/') . '/';
$parts = explode('=', $this->dsn, 2);
switch ($parts[0]) {
case 'apc':
case 'apcu':
$info = apc_cache_info('user');
if (!empty($info['cache_list'])) {
$key = array_key_exists('info', $info['cache_list'][0]) ? 'info' : 'key';
$mtkey = array_key_exists('mtime', $info['cache_list'][0]) ? 'mtime' : 'modification_time';
foreach ($info['cache_list'] as $item) {
if (preg_match($regex, $item[$key]) && $item[$mtkey] + $lifetime < time()) {
apc_delete($item[$key]);
}
}
}
return TRUE;
case 'redis':
$fw = Base::instance();
$keys = $this->ref->keys($this->prefix . '.*' . $suffix);
foreach ($keys as $key) {
$val = $fw->unserialize($this->ref->get($key));
if ($val[1] + $lifetime < time()) {
$this->ref->del($key);
}
}
return TRUE;
case 'memcache':
foreach (memcache_get_extended_stats($this->ref, 'slabs') as $slabs) {
foreach (array_filter(array_keys($slabs), 'is_numeric') as $id) {
foreach (memcache_get_extended_stats($this->ref, 'cachedump', $id) as $data) {
if (is_array($data)) {
foreach ($data as $key => $val) {
if (preg_match($regex, $key) && $val[1] + $lifetime < time()) {
memcache_delete($this->ref, $key);
}
}
}
}
}
}
return TRUE;
case 'wincache':
$info = wincache_ucache_info();
foreach ($info['ucache_entries'] as $item) {
if (preg_match($regex, $item['key_name']) && $item['use_time'] + $lifetime < time()) {
wincache_ucache_delete($item['key_name']);
}
}
return TRUE;
case 'xcache':
return TRUE;
/* Not supported */
/* Not supported */
case 'folder':
if ($glob = @glob($parts[1] . '*')) {
foreach ($glob as $file) {
if (preg_match($regex, basename($file)) && filemtime($file) + $lifetime < time()) {
@unlink($file);
}
}
}
return TRUE;
}
return FALSE;
}
示例12: getStats
/**
* @return driverStatistic
*/
public function getStats()
{
$memInfo = wincache_ucache_meminfo();
$info = wincache_ucache_info();
$date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']);
return (new driverStatistic())->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))->setSize($memInfo['memory_free'] - $memInfo['memory_total'])->setData(implode(', ', array_keys($this->itemInstances)))->setRawData($memInfo);
}
示例13: queryKeys
/**
* {@inheritdoc}
*
* @param string $prefix
* @return array
*/
public function queryKeys($prefix = null)
{
$info = wincache_ucache_info();
$entries = array();
foreach ($info['ucache_entries'] as $entry) {
if ($prefix === null) {
$entries[] = $entry['key_name'];
} else {
if (substr($entry['key_name'], 0, strlen($prefix)) === $prefix) {
$entries[] = $entry['key_name'];
}
}
}
return $entries;
}
示例14: get_metadata
/**
* Get Cache Metadata
*
* @param mixed key to get cache metadata on
* @return mixed array on success/false on failure
*/
public function get_metadata($id)
{
if ($stored = wincache_ucache_info(FALSE, $id)) {
$age = $stored['ucache_entries'][1]['age_seconds'];
$ttl = $stored['ucache_entries'][1]['ttl_seconds'];
$hitcount = $stored['ucache_entries'][1]['hitcount'];
return array('expire' => $ttl - $age, 'hitcount' => $hitcount, 'age' => $age, 'ttl' => $ttl);
}
return FALSE;
}
示例15: clear
/**
* Delete all keys from the cache. This will clear every
* item in the cache matching the cache config prefix.
*
* @param bool $check If true, nothing will be cleared, as entries will
* naturally expire in wincache..
* @return bool True Returns true.
*/
public function clear($check)
{
if ($check) {
return true;
}
$info = wincache_ucache_info();
$cacheKeys = $info['ucache_entries'];
unset($info);
foreach ($cacheKeys as $key) {
if (strpos($key['key_name'], $this->_config['prefix']) === 0) {
wincache_ucache_delete($key['key_name']);
}
}
return true;
}