1 bootstrap.inc public BackdropCacheArray::__destruct()

Destructs the BackdropCacheArray object.

File

core/includes/bootstrap.inc, line 471
Functions that need to be loaded on every Backdrop request.

Class

BackdropCacheArray
Provides a caching wrapper to be used in place of large array structures.

Code

public function __destruct() {
  if (!is_array($this->keysToPersist)) {
    throw new UnexpectedValueException();
  }
  $data = array();
  foreach ($this->keysToPersist as $offset => $persist) {
    if ($persist) {
      $data[$offset] = $this->storage[$offset];
    }
  }
  if (!empty($data)) {
    $this->set($data);
  }
}