You are here

public function KeyValueCache::has in Permissions by Term 8.2

File

src/Cache/KeyValueCache.php, line 58

Class

KeyValueCache

Namespace

Drupal\permissions_by_term\Cache

Code

public function has() : bool {
  $cid = 'permissions_by_term:key_value_cache';
  $staticCache =& drupal_static(__FUNCTION__ . $cid, NULL);
  if ($staticCache) {
    $data = $staticCache;
    if (!is_array($data)) {
      return FALSE;
    }
    return TRUE;
  }
  $result = $this->cache
    ->get($cid);
  if (!isset($result->data)) {
    return FALSE;
  }
  $data = $result->data;
  if (!is_array($data)) {
    return FALSE;
  }
  return TRUE;
}