/**
  * Retrieves (up to) the last $count tweets searched by the $query
  * 
  * Note: Actual returned number may be less than 10 due to reasons
  * 
  * @param string $query Search terms
  * @param integer $count Number of tweets
  * @return ArrayList List of tweets
  */
 public function SearchTweets($query, $count = 10)
 {
     if (empty($query)) {
         return null;
     }
     $tweets = $this->twitterService->searchTweets($query, $count);
     return $this->viewableTweets($tweets);
 }
 public function searchTweets($query, $count)
 {
     // Init caching
     $cacheKey = "searchTweets_" . str_replace("-", "_", Convert::raw2url($query)) . "_{$count}";
     $cache = SS_Cache::factory('CachedTwitterService');
     // Return cached value, if available
     if ($rawResult = $cache->load($cacheKey)) {
         return unserialize($rawResult);
     }
     // Save and return
     $result = $this->cachedService->searchTweets($query, $count);
     $cache->save(serialize($result), $cacheKey, array(), Config::inst()->get('CachedTwitterService', 'lifetime'));
     // Refresh the 'TimeAgo' field, as the cached value would now be outdated, or the locale could have changed.
     if ($result) {
         foreach ($result as $index => $item) {
             $result[$index]['TimeAgo'] = TwitterService::determine_time_ago($item['Date']);
         }
     }
     return $result;
 }