/** * get results of a search query using a caching strategy if available * @return the result documents as an array of search objects */ private function get_results() { $cache = new SearchCache(); if ($this->cache && $cache->can_cache()) { if (!($resultdocs = $cache->cache($this->term))) { $resultdocs = $this->process_results(); //cache the results so we don't have to compute this on every page-load $cache->cache($this->term, $resultdocs); //print "Using new results."; } else { //There was something in the cache, so we're using that to save time //print "Using cached results."; } } else { //no caching :( // print "Caching disabled!"; $resultdocs = $this->process_results(); } return $resultdocs; }