You are here

public function SensorRunner::loadCache in Monitoring 7

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

Loads available sensor results from cache.

1 call to SensorRunner::loadCache()
SensorRunner::__construct in lib/Drupal/monitoring/SensorRunner.php
Constructs a SensorRunner.

File

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

Class

SensorRunner
Instantiate and run requested sensors.

Namespace

Drupal\monitoring

Code

public function loadCache() {
  $cids = array();

  // Only load sensor caches if they define caching.
  foreach ($this->sensors as $name => $sensor_info) {
    if ($sensor_info
      ->getCachingTime()) {
      $cids[] = $this
        ->getSensorCid($name);
    }
  }
  if ($cids) {
    foreach (cache_get_multiple($cids) as $cache) {
      if ($cache->expire > REQUEST_TIME) {
        $this->cache[$cache->data['name']] = $cache->data;
      }
    }
  }
}