You are here

public static function SensorRunner::resetCache in Monitoring 7

Same name and namespace in other branches
  1. 8 src/SensorRunner.php \Drupal\monitoring\SensorRunner::resetCache()

Reset sensor result caches.

Parameters

array $sensor_names: (optional) Array of sensors to reset the cache for. An empty array clears all results, which is the default.

4 calls to SensorRunner::resetCache()
MonitoringUITest::checkExceedsThresholdSettings in test/tests/monitoring.ui.test
Tests exceeds threshold settings UI and validation.
monitoring_force_execution in ./monitoring.admin.inc
Page callback to clear sensor caches.
monitoring_sensor_details_submit in ./monitoring.admin.inc
Submit sensor details form.
monitoring_sensor_settings_save in ./monitoring.module
Saves sensor settings.

File

lib/Drupal/monitoring/SensorRunner.php, line 357
Contains \Drupal\monitoring\SensorRunner.

Class

SensorRunner
Instantiate and run requested sensors.

Namespace

Drupal\monitoring

Code

public static function resetCache(array $sensor_names = array()) {
  if (empty($sensor_names)) {

    // No sensor names provided, clear all caches.
    cache_clear_all('monitoring_sensor_result:', 'cache', TRUE);
  }
  else {
    foreach ($sensor_names as $sensor_name) {
      cache_clear_all(self::getSensorCid($sensor_name), 'cache');
    }
  }
}