You are here

public function SpiController::dataStoreSet in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Controller/SpiController.php \Drupal\acquia_connector\Controller\SpiController::dataStoreSet()
  2. 3.x src/Controller/SpiController.php \Drupal\acquia_connector\Controller\SpiController::dataStoreSet()

Put SPI data in local storage.

Parameters

array $data: Keyed array of data to store.

int $expire: Expire time or null to use default of 1 day.

File

src/Controller/SpiController.php, line 840

Class

SpiController
SPI Controller class.

Namespace

Drupal\acquia_connector\Controller

Code

public function dataStoreSet(array $data, $expire = NULL) {
  if (is_null($expire)) {
    $expire = \Drupal::time()
      ->getRequestTime() + 60 * 60 * 24;
  }
  foreach ($data as $key => $value) {
    \Drupal::cache()
      ->set('acquia.spi.' . $key, $value, $expire);
  }
}