/** * Generates an array with terms and hits * * @return Tags as array with terms and hits */ protected function getFrequentSearchTerms() { $terms = array(); // Use configuration as cache identifier $identifier = 'frequentSearchesTags_' . md5(serialize($this->configuration['search.']['frequentSearches.'])); if ($this->cacheInstance->has($identifier)) { $terms = $this->cacheInstance->get($identifier); } else { $terms = $this->getFrequentSearchTermsFromStatistics(); if ($this->configuration['search.']['frequentSearches.']['sortBy'] == 'hits') { arsort($terms); } else { ksort($terms); } $lifetime = NULL; if (isset($this->configuration['search.']['frequentSearches.']['cacheLifetime'])) { $lifetime = intval($this->configuration['search.']['frequentSearches.']['cacheLifetime']); } $this->cacheInstance->set($identifier, $terms, array(), $lifetime); } return $terms; }
/** * Constructs the cache * * @param string A identifier which describes this cache * @param t3lib_cache_backend_Backend Backend to be used for this cache * @author Robert Lemke <*****@*****.**> * @throws InvalidArgumentException if the identifier doesn't match PATTERN_ENTRYIDENTIFIER * @internal */ public function __construct($identifier, t3lib_cache_backend_Backend $backend) { parent::__construct($identifier, $backend); $this->initializeObject(); }