/**
  * 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;
 }