You are here

public function KeyValueCache::get in Permissions by Term 8.2

File

src/Cache/KeyValueCache.php, line 38

Class

KeyValueCache

Namespace

Drupal\permissions_by_term\Cache

Code

public function get() : array {
  $cid = 'permissions_by_term:key_value_cache';
  $staticCache =& drupal_static(__FUNCTION__ . $cid, NULL);
  if ($staticCache) {
    return $staticCache;
  }
  $result = $this->cache
    ->get($cid);
  $data = $result->data;
  if (!is_array($data)) {
    throw new \Exception('Result from cache was not an array.');
  }
  return $data;
}