You are here

function apachesolr_static_response_cache in Apache Solr Search 6

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_static_response_cache()
  2. 5.2 apachesolr.module \apachesolr_static_response_cache()
  3. 5 apachesolr.module \apachesolr_static_response_cache()
  4. 6.3 apachesolr.module \apachesolr_static_response_cache()
  5. 6.2 apachesolr.module \apachesolr_static_response_cache()
  6. 7 apachesolr.module \apachesolr_static_response_cache()

It is important to hold on to the Solr response object for the duration of the page request so that we can use it for things like building facet blocks.

@todo reverse the order of parameters in future branches.

5 calls to apachesolr_static_response_cache()
apachesolr_block in ./apachesolr.module
Implementation of hook_block().
apachesolr_do_query in ./apachesolr.module
Execute a search based on a query object.
apachesolr_og_block in contrib/apachesolr_og/apachesolr_og.module
Implementation of hook_block().
apachesolr_search_block in ./apachesolr_search.module
Implementation of hook_block().
apachesolr_search_form_search_form_alter in ./apachesolr_search.module
Implementation of hook_form_[form_id]_alter().

File

./apachesolr.module, line 1417
Integration with the Apache Solr search application.

Code

function apachesolr_static_response_cache($response = NULL, $namespace = 'apachesolr_search') {
  static $_response = array();
  if (is_object($response)) {
    $_response[$namespace] = clone $response;
  }
  if (!isset($_response[$namespace])) {
    $_response[$namespace] = NULL;
  }
  return $_response[$namespace];
}