You are here

protected function ApiSync::setCache in FormAssembly 8

Helper method to store a set of form and page count in cache.

Parameters

string $id: The cache id.

1 call to ApiSync::setCache()
ApiSync::getForms in src/ApiSync.php
Get data about available forms.

File

src/ApiSync.php, line 176

Class

ApiSync
Service class for FormAssembly API: Handles form sync.

Namespace

Drupal\formassembly

Code

protected function setCache($id) {
  if (empty($id)) {

    // Nothing to retrieve.
    return;
  }
  $data = [
    'forms' => $this->forms,
    'page' => $this->page,
    'hash' => $this->lastHash,
  ];

  // We will clean up after ourselves in syncForms() but set a 24 hour expire
  // to guard against ever growing cache bin.
  $this->cache
    ->set($id, $data, strtotime('+1 day'));
}