You are here

protected function SensorRunner::loadCache in Monitoring 8

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

Loads available sensor results from cache.

Parameters

\Drupal\monitoring\Entity\SensorConfig[] $sensors_config: List of sensor config object that we want to run.

1 call to SensorRunner::loadCache()
SensorRunner::runSensors in src/SensorRunner.php
Runs the defined sensors.

File

src/SensorRunner.php, line 90
Contains \Drupal\monitoring\SensorRunner.

Class

SensorRunner
Instantiate and run requested sensors.

Namespace

Drupal\monitoring

Code

protected function loadCache(array $sensors_config) {
  $cids = array();

  // Only load sensor caches if they define caching.
  foreach ($sensors_config as $sensor_config) {
    if ($sensor_config
      ->getCachingTime()) {
      $cids[] = $this
        ->getSensorCid($sensor_config
        ->id());
    }
  }
  if ($cids) {
    foreach ($this->cache
      ->getMultiple($cids) as $cache) {
      $this->sensorResultCache[$cache->data['name']] = $cache->data;
    }
  }
}