You are here

public function DrupalApacheSolrService::clearCache in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::clearCache()
  2. 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::clearCache()

Clear cached Solr data.

Overrides DrupalApacheSolrServiceInterface::clearCache

File

./Drupal_Apache_Solr_Service.php, line 379

Class

DrupalApacheSolrService
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

public function clearCache() {

  // Don't clear cached data if the server is unavailable.
  if (@$this
    ->ping()) {
    $this
      ->_clearCache();
  }
  else {
    throw new Exception('No Solr instance available when trying to clear the cache.');
  }
}