本文整理汇总了PHP中apc_cache_info函数的典型用法代码示例。如果您正苦于以下问题:PHP apc_cache_info函数的具体用法?PHP apc_cache_info怎么用?PHP apc_cache_info使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apc_cache_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initAPCSpec
private function initAPCSpec()
{
$this->setName(pht('APC'))->setVersion(phpversion('apc'));
if (ini_get('apc.enabled')) {
$this->setIsEnabled(true)->setClearCacheCallback('apc_clear_cache');
$mem = apc_sma_info();
$this->setTotalMemory($mem['num_seg'] * $mem['seg_size']);
$info = apc_cache_info();
$this->setUsedMemory($info['mem_size']);
$write_lock = ini_get('apc.write_lock');
$slam_defense = ini_get('apc.slam_defense');
if (!$write_lock || $slam_defense) {
$summary = pht('Adjust APC settings to quiet unnecessary errors.');
$message = pht('Some versions of APC may emit unnecessary errors into the ' . 'error log under the current APC settings. To resolve this, ' . 'enable "%s" and disable "%s" in your PHP configuration.', 'apc.write_lock', 'apc.slam_defense');
$this->newIssue('extension.apc.write-lock')->setShortName(pht('Noisy APC'))->setName(pht('APC Has Noisy Configuration'))->setSummary($summary)->setMessage($message)->addPHPConfig('apc.write_lock')->addPHPConfig('apc.slam_defense');
}
$is_dev = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
$is_stat_enabled = ini_get('apc.stat');
if ($is_stat_enabled && !$is_dev) {
$summary = pht('"%s" is currently enabled, but should probably be disabled.', 'apc.stat');
$message = pht('The "%s" setting is currently enabled in your PHP configuration. ' . 'In production mode, "%s" should be disabled. ' . 'This will improve performance slightly.', 'apc.stat', 'apc.stat');
$this->newIssue('extension.apc.stat-enabled')->setShortName(pht('"%s" Enabled', 'apc.stat'))->setName(pht('"%s" Enabled in Production', 'apc.stat'))->setSummary($summary)->setMessage($message)->addPHPConfig('apc.stat')->addPhabricatorConfig('phabricator.developer-mode');
} else {
if (!$is_stat_enabled && $is_dev) {
$summary = pht('"%s" is currently disabled, but should probably be enabled.', 'apc.stat');
$message = pht('The "%s" setting is currently disabled in your PHP configuration, ' . 'but Phabricator is running in development mode. This option should ' . 'normally be enabled in development so you do not need to restart ' . 'anything after making changes to the code.', 'apc.stat');
$this->newIssue('extension.apc.stat-disabled')->setShortName(pht('"%s" Disabled', 'apc.stat'))->setName(pht('"%s" Disabled in Development', 'apc.stat'))->setSummary($summary)->setMessage($message)->addPHPConfig('apc.stat')->addPhabricatorConfig('phabricator.developer-mode');
}
}
} else {
$this->setIsEnabled(false);
$this->raiseEnableAPCIssue();
}
}
示例2: _checkApc
protected function _checkApc()
{
if (function_exists('apc_cache_info') && ($cache = @apc_cache_info($cache_mode))) {
return true;
}
return false;
}
示例3: index
function index()
{
/* $usercache = apc_cache_info('user',false);
$entrycount = count($usercache['cache_list']);
$usercache = $usercache['cache_list'];
$cnt=0;
foreach($usercache as $i)
{
@list($label,$key) = explode(":",$i['info'],2);
@list($t,$val) = explode("\t",apc_fetch($i['info']));
if ($val<=5) continue;
$cnt++; if ($cnt > 1000) break;
if ($key && is_scalar($key)) $tmp[$label][$key] = $val.' '.$i['num_hits'];
else $tmp['other'][$i['info']] = $val.' '.$i['num_hits'];
}
$usercache=NULL;
foreach($tmp as &$tmp2)
{
arsort($tmp2);
}
*/
return array('info' => apc_cache_info(), 'sma' => apc_sma_info(true), 'entrycount' => 0);
}
示例4: __construct
/**
* Constructor
*
* Instantiate the APC cache object
*
* @throws Exception
* @return \Pop\Cache\Adapter\Apc
*/
public function __construct()
{
if (!function_exists('apc_cache_info')) {
throw new Exception('Error: APC is not available.');
}
$this->info = apc_cache_info();
}
示例5: info
public function info($type = "user", $limited = false)
{
if (CACHE_STATUS) {
apc_cache_info($type, $limited);
}
return false;
}
示例6: index
public function index($f3)
{
$f3->set("title", $f3->get("dict.administration"));
$f3->set("menuitem", "admin");
if ($f3->get("POST.action") == "clearcache") {
\Cache::instance()->reset();
$f3->set("success", "Cache cleared successfully.");
}
$db = $f3->get("db.instance");
// Gather some stats
$result = $db->exec("SELECT COUNT(id) AS `count` FROM user WHERE deleted_date IS NULL AND role != 'group'");
$f3->set("count_user", $result[0]["count"]);
$result = $db->exec("SELECT COUNT(id) AS `count` FROM issue WHERE deleted_date IS NULL");
$f3->set("count_issue", $result[0]["count"]);
$result = $db->exec("SELECT COUNT(id) AS `count` FROM issue_update");
$f3->set("count_issue_update", $result[0]["count"]);
$result = $db->exec("SELECT COUNT(id) AS `count` FROM issue_comment");
$f3->set("count_issue_comment", $result[0]["count"]);
$result = $db->exec("SELECT value as version FROM config WHERE attribute = 'version'");
$f3->set("version", $result[0]["version"]);
if ($f3->get("CACHE") == "apc") {
$f3->set("apc_stats", apc_cache_info("user", true));
}
$this->_render("admin/index.html");
}
示例7: info
public function info($type = "user", $limited = FALSE)
{
if (_cacheStatus) {
apc_cache_info($type, $limited);
}
return FALSE;
}
示例8: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$panel = '';
# Support for APC
if (function_exists('apc_sma_info') && ini_get('apc.enabled')) {
$mem = apc_sma_info();
$mem_size = $mem['num_seg'] * $mem['seg_size'];
$mem_avail = $mem['avail_mem'];
$mem_used = $mem_size - $mem_avail;
$cache = apc_cache_info();
$panel .= '<h4>APC ' . phpversion('apc') . ' Enabled</h4>';
$panel .= round($mem_avail / 1024 / 1024, 1) . 'M available, ' . round($mem_used / 1024 / 1024, 1) . 'M used<br />' . $cache['num_entries'] . ' Files cached (' . round($cache['mem_size'] / 1024 / 1024, 1) . 'M)<br />' . $cache['num_hits'] . ' Hits (' . round($cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']), 1) . '%)<br />' . $cache['expunges'] . ' Expunges (cache full count)';
}
foreach ($this->_cacheBackends as $name => $backend) {
$fillingPercentage = $backend->getFillingPercentage();
$ids = $backend->getIds();
# Print full class name, backends might be custom
$panel .= '<h4>Cache ' . $name . ' (' . get_class($backend) . ')</h4>';
$panel .= count($ids) . ' Entr' . (count($ids) > 1 ? 'ies' : 'y') . '<br />' . 'Filling Percentage: ' . $backend->getFillingPercentage() . '%<br />';
$cacheSize = 0;
foreach ($ids as $id) {
# Calculate valid cache size
$mem_pre = memory_get_usage();
if ($cached = $backend->load($id)) {
$mem_post = memory_get_usage();
$cacheSize += $mem_post - $mem_pre;
unset($cached);
}
}
$panel .= 'Valid Cache Size: ' . round($cacheSize / 1024, 1) . 'K';
}
return $panel;
}
示例9: onGet
/**
* @return Index
*/
public function onGet()
{
$cache = PHP_SAPI !== 'cli' ? apc_cache_info('user') : ['num_entries' => 0, 'mem_size' => 0];
$this['apc'] = ['total' => $cache['num_entries'], 'size' => $cache['mem_size']];
// page speed.
$this['performance'] = $this->resource->get->uri('app://self/performance')->request();
return $this;
}
示例10: getStatistics
/**
* @return Statistics[]
*/
public function getStatistics()
{
if (!$this->safe) {
return array();
}
$apcInfo = apc_cache_info('user', true);
return array('APC' => new Statistics($apcInfo['num_hits'], $apcInfo['num_misses']));
}
示例11: __construct
/**
* Constructor
*
* Instantiate the APC cache object
*
* @param int $lifetime
* @throws Exception
* @return Apc
*/
public function __construct($lifetime = 0)
{
parent::__construct($lifetime);
if (!function_exists('apc_cache_info')) {
throw new Exception('Error: APC is not available.');
}
$this->info = apc_cache_info();
}
示例12: info
/**
* Retrieves cached information from APC's data store.
*
* @param string $type - If $type is "user", information about the user cache will be returned.
* @param boolean $limited - If $limited is true, the return value will exclude the individual
* list of cache entries. This is useful when trying to optimize calls
* for statistics gathering.
*
* @return array of cached data (and meta-data) or false on failure.
*/
public static function info($type = '', $limited = false)
{
try {
return apc_cache_info($type, $limited);
} catch (\RuntimeException $e) {
throw new CacheException($e->getMessage());
}
}
示例13: apcinfo
function apcinfo()
{
foreach (apc_cache_info() as $k => $v) {
if ($k != 'cache_info') {
printf("%s: %s\n", $k, $v);
}
}
}
示例14: __construct
public function __construct()
{
$this->extension['redis'] = extension_loaded('redis');
$this->extension['memcache'] = extension_loaded('memcache');
$this->extension['apc'] = function_exists('apc_cache_info') && @apc_cache_info();
$this->extension['xcache'] = function_exists('xcache_get');
$this->extension['eaccelerator'] = function_exists('eaccelerator_get');
}
示例15: __construct
public function __construct()
{
$this->keys = array();
$cache_info = apc_cache_info('user');
foreach ($cache_info['cache_list'] as $entry) {
$this->keys[$entry['info']] = $entry['ttl'];
}
}