Get stats about the token cache
@return Array An array containing the keys 'hits', 'misses', 'entries', and 'size' in bytes
543272
public static function getCacheStats()
    {
        return array(
            'hits'=>self::$cache_hits,
            'misses'=>self::$cache_misses,
            'entries'=>count(self::$token_cache),
            'size'=>strlen(serialize(self::$token_cache))
        );
    }
111674
public function collectStats()
    {
        Container::get('hooks')->fire('model.index.collect_stats_start');

        // Collect some statistics from the database
        if (!Container::get('cache')->isCached('users_info')) {
            Container::get('cache')->store('users_info', Cache::getUsersInfo());
        }

        $stats = Container::get('cache')->retrieve('users_info');

        $query = DB::forTable('forums')
            ->select_expr('SUM(num_topics)', 'total_topics')
            ->select_expr('SUM(num_posts)', 'total_posts');

        $query = Container::get('hooks')->fireDB('model.index.collect_stats_query', $query);

        $query = $query->find_one();

        $stats['total_topics'] = Utils::numberFormat((int)$query['total_topics']);
        $stats['total_posts'] = Utils::numberFormat((int)$query['total_posts']);

        if (User::get()->g_view_users == '1') {
            $stats['newest_user'] = '<a href="'.
                Router::pathFor('userProfile', ['id' => $stats['last_user']['id']]).'">'.
                Utils::escape($stats['last_user']['username']).'</a>';
        } else {
            $stats['newest_user'] = Utils::escape($stats['last_user']['username']);
        }
        $stats['total_users'] = Utils::numberFormat((int)$stats['total_users']);

        $stats = Container::get('hooks')->fire('model.index.collect_stats', $stats);

        return $stats;
    }
262396
public function collect()
    {
        $this->templateCount = $this->blockCount = $this->macroCount = 0;
        $this->templates     = array();
        $this->computeData($this->profile);

        return array(
            'nb_templates'                => $this->templateCount,
            'nb_blocks'                   => $this->blockCount,
            'nb_macros'                   => $this->macroCount,
            'templates'                   => $this->templates,
            'accumulated_render_time'     => $this->profile->getDuration(),
            'accumulated_render_time_str' => $this->getDataFormatter()->formatDuration($this->profile->getDuration()),
            'memory_usage_str'            => $this->getDataFormatter()->formatBytes($this->profile->getMemoryUsage()),
            'callgraph'                   => $this->getHtmlCallGraph(),
            'badge'                       => implode(
                '/',
                array(
                    $this->templateCount,
                    $this->blockCount,
                    $this->macroCount,
                )
            ),
        );
    }
427929
public function getTokenHashes() : ? array {
		$stmt = $this->db->prepare(
			"SELECT login_hash, api_hash FROM sessions WHERE user_id=?"
		);
		$stmt->bind_param("i", $this->user->id);
		$stmt->execute();
		return $stmt->get_result()->fetch_array(MYSQLI_ASSOC);
	}
81055
public function getEntries()
    {
        $url = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE, ['entries']);
        $result = $this->getConnection()->get($url);

        return $result->getJson();
    }
578537
public function getCacheHits()
    {
        return array_reduce(iterator_to_array($this->getCommands()), function ($hits, $value) {
            $hits += $value['cache'];

            return $hits;
        });
    }
1136988
protected function getTokenReplaces()
    {
        $replaces = array();

        foreach ($this->tokens as $token => $value) {
            $key              = $this->getFormatter()->untokenize($token);
            $formatter        = $this->getTokenFormatter($key);
            $replaces[$token] = $formatter::format($value);
        }

        return $replaces;
    }
1181376
public function getDefinitionCache(): array
    {
        return [
            $this->name,
            $this->methods,
            $this->segments,
            $this->patterns,
            $this->handler,
            $this->format,
            $this->parameterNames,
        ];
    }
1261604
public function get_computed_keys() {
		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
			return self::$memo[ get_called_class() ][ __METHOD__ ];
		}

		$keys = array();

		foreach ( $this->get_attribute_keys() as $key ) {
			if ( $this->has_compute_method( $key ) ) {
				$keys[] = $key;
			}
		}

		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
	}
486036
public function getTokens()
    {
        $conditions = '';
        $params = array();
        $records = Oauth_TokenRecord::model()->findAll($conditions, $params);
        return Oauth_TokenModel::populateModels($records);
    }
1044334
public function getEntries()
    {

        $count = $this->getEntryCount();
        $size = $this->getManifestSize() + 4;

        $this->reader->seek(
            $this->offset
            + 18
            + $this->getAliasSize()
            + 4
            + $this->getMetadataSize()
        );

        return $this->readFileList($count, $size);
    }
1328391
protected function getCacheTagsAndLifetime()
    {
        $lifetime = null;
        $tags = array();
        $entriesMetadata = $this->contentCacheFrontend->getAllMetadata();
        foreach ($entriesMetadata as $identifier => $metadata) {
            $entryTags = isset($metadata['tags']) ? $metadata['tags'] : array();
            $entryLifetime = isset($metadata['lifetime']) ? $metadata['lifetime'] : null;

            if ($entryLifetime !== null) {
                if ($lifetime === null) {
                    $lifetime = $entryLifetime;
                } else {
                    $lifetime = min($lifetime, $entryLifetime);
                }
            }
            $tags = array_unique(array_merge($tags, $entryTags));
        }
        return array($tags, $lifetime);
    }
35251
public function getInfo()
    {
        return array(
            'ucache_meminfo' => wincache_ucache_meminfo(),
            'ucache_info' =>    wincache_ucache_info(),
            'session_cache_info' => wincache_scache_info(),
            'session_cache_meminfo' =>  wincache_scache_meminfo(),
            'rp_meminfo' => wincache_rplist_meminfo(),
            'rp_fileinfo' =>    wincache_rplist_fileinfo(),
            'opcode_fileinfo' =>    wincache_ocache_fileinfo(),
            'opcode_meminfo' => wincache_ocache_meminfo(),
            'filecache_meminfo' =>  wincache_fcache_fileinfo(),
            'filecache_fileinfo' => wincache_fcache_meminfo()
        );
    }
1315408
protected function _parseTokens()
    {
        for ($index = 0; $index < $this->_length; ++$index) {
            $token = $this->_password[$index];
            $tokenAsciiValue = ord($token);

            if ($tokenAsciiValue >= 48 && $tokenAsciiValue <= 57) {
                $tokenClass = self::CLASS_NUMBER;
            } elseif ($tokenAsciiValue >= 65 && $tokenAsciiValue <= 90) {
                $tokenClass = self::CLASS_UPPER;
            } elseif ($tokenAsciiValue >= 97 && $tokenAsciiValue <= 122) {
                $tokenClass = self::CLASS_LOWER;
            } else {
                $tokenClass = self::CLASS_SYMBOL;
            }

            // Track the number and index of tokens belonging to class
            ++$this->_tokenCounts[$tokenClass];
            $this->_tokenIndices[$tokenClass][] = $index;

            // Members of UPPER and LOWER also belong to LETTER
            if ($tokenClass == self::CLASS_UPPER || $tokenClass == self::CLASS_LOWER) {
                ++$this->_tokenCounts[self::CLASS_LETTER];
                $this->_tokenIndices[self::CLASS_LETTER][] = $index;
            }

            // Track the number of times this token appears
            if (array_key_exists($token, $this->_tokens)) {
                $this->_tokens[$token] += 1;
            } else {
                $this->_tokens[$token] = 1;
            }
        }
    }
665159
public static function GetCacheLimiterList () {
		return [
			static::CACHE_LIMITER_PUBLIC				=> static::CACHE_LIMITER_PUBLIC,
			static::CACHE_LIMITER_PRIVATE_NO_EXPIRE		=> static::CACHE_LIMITER_PRIVATE_NO_EXPIRE,
			static::CACHE_LIMITER_PRIVATE				=> static::CACHE_LIMITER_PRIVATE,
			static::CACHE_LIMITER_NOCACHE				=> static::CACHE_LIMITER_NOCACHE,
			static::CACHE_LIMITER_NOT_SEND_HEADER		=> static::CACHE_LIMITER_NOT_SEND_HEADER,
		];
	}
389308
public static function getMostReadCache()
    {
        $mostRead = Cache::get("most_read_articles");
        if(!$mostRead || $mostRead == null || $mostRead->isEmpty()) {
            return [];
        }
        return $mostRead;
    }
11839
public function stats()
    {
        $ResqueStatus = $this->ResqueStatus;

        $workers = CakeResque::getWorkers();

        // List of all queues
        $queues = array_unique(CakeResque::getQueues());

        // List of queues monitored by a worker
        $activeQueues = [];
        foreach ($workers as $worker) {
            $workerParams = explode(':', $worker);
            $activeQueues = array_merge($activeQueues, explode(',', array_pop($workerParams)));
        }

        $this->out("\n");
        $this->out('<info>' . __d('cake_resque', 'Resque Statistics') . '</info>');
        $this->hr();
        $this->out("\n");

        $this->out('<info>' . __d('cake_resque', 'Jobs Stats') . '</info>');
        $this->out('   ' . __d('cake_resque', 'Processed Jobs : {0}', number_format(Resque_Stat::get('processed'))));
        $this->out('   <warning>' . __d('cake_resque', 'Failed Jobs    : {0}', number_format(Resque_Stat::get('failed'))) . '</warning>');

        if (Configure::read('CakeResque.Scheduler.enabled') === true) {
            $this->out('   ' . __d('cake_resque', 'Scheduled Jobs : {0}', number_format(Stat::get())));
        }

        $this->out("\n");

        $count = [];
        $this->out('<info>' . __d('cake_resque', 'Queues Stats') . '</info>');
        for ($i = count($queues) - 1; $i >= 0; --$i) {
            $count[ $queues[ $i ] ] = CakeResque::getQueueSize($queues[ $i ]);
            if (!in_array($queues[ $i ], $activeQueues) && $count[ $queues[ $i ] ] == 0) {
                unset($queues[ $i ]);
            }
        }

        $this->out('   ' . __d('cake_resque', 'Queues count : {0}', count($queues)));
        foreach ($queues as $queue) {
            $this->out(sprintf("\t- %-15s : %12s %s", $queue, number_format($count[ $queue ]), __dn('cake_resque', 'pending job', 'pending jobs', $count[ $queue ]) . (!in_array($queue, $activeQueues) ? " <error>(unmonitored queue)</error>" : '')));
        }

        $this->out("\n");
        $this->out('<info>' . __d('cake_resque', 'Workers Stats') . '</info>');
        $this->out('   ' . __d('cake_resque', 'Workers count : {0}', count($workers)));

        $pausedWorkers = $ResqueStatus->getPausedWorker();
        $schedulerWorkers = [];

        if (!empty($workers)) {
            $this->out("\t<info>" . strtoupper(__d('cake_resque', 'regular workers')) . "</info>");
            foreach ($workers as $worker) {
                if (Configure::read('CakeResque.Scheduler.enabled') === true && $ResqueStatus->isSchedulerWorker($worker)) {
                    $schedulerWorkers[] = $worker;
                    continue;
                }
                $this->out("\t* <bold>" . (string)$worker . '</bold>' . (in_array((string)$worker, $pausedWorkers) ? ' <warning>(' . __d('cake_resque', 'paused') . ')</warning>' : ''));
                $this->out("\t   - " . __d('cake_resque', 'Started on') . "     : " . CakeResque::getWorkerStartDate($worker));
                $this->out("\t   - " . __d('cake_resque', 'Processed Jobs') . " : " . $worker->getStat('processed'));
                $worker->getStat('failed') == 0
                    ? $this->out("\t   - " . __d('cake_resque', 'Failed Jobs') . "    : " . $worker->getStat('failed'))
                    : $this->out("\t   - <warning>" . __d('cake_resque', 'Failed Jobs') . "    : " . $worker->getStat('failed') . "</warning>");
            }
        }

        $this->out("\n");

        if (!empty($schedulerWorkers)) {
            $this->out("\t<info>" . strtoupper(__d('cake_resque', 'scheduler worker')) . "</info>" . (in_array((string)$schedulerWorkers[0], $pausedWorkers) ? ' <warning>(' . __d('cake_resque', 'paused') . ')</warning>' : ''));
            foreach ($schedulerWorkers as $worker) {
                $schedulerWorker = new ResqueScheduler();
                $delayedJobCount = $schedulerWorker->getDelayedQueueScheduleSize();
                $this->out("\t   - " . __d('cake_resque', 'Started on') . "     : " . CakeResque::getWorkerStartDate($worker));
                $this->out("\t   - " . __d('cake_resque', 'Delayed Jobs') . "   : " . $delayedJobCount);

                if ($delayedJobCount > 0) {
                    $this->out("\t   - " . __d('cake_resque', 'Next Job on') . "    : " . strftime('%a %b %d %H:%M:%S %Z %Y', $schedulerWorker->nextDelayedTimestamp()));
                }
            }
            $this->out("\n");
        } elseif (Configure::read('CakeResque.Scheduler.enabled') === true) {
            $jobsCount = ResqueScheduler::getDelayedQueueScheduleSize();
            if ($jobsCount > 0) {
                $this->out("\t<error>************ " . __d('cake_resque', 'Alert') . " ************</error>");
                $this->out("\t<bold>" . __d('cake_resque', 'The Scheduler Worker is not running') . "</bold>");
                $this->out("\t" . __d('cake_resque', 'But there is still <bold>{0}</bold> scheduled jobs left in its queue', $jobsCount));
                $this->out("\t<error>********************************</error>");
                $this->out("\n");
            }
        }
    }