/** * {@inheritdoc} */ public function getRolePermissions(Role $role) { $cacheId = sprintf('roles/%s', $role->getRoleName()); $permissions = $this->cache->fetch($cacheId); if (!$this->cache->contains($cacheId)) { $permissions = $this->driver->getRolePermissions($role); $this->cache->save($cacheId, $permissions); } return $permissions; }
/** * {@inheritdoc} */ public function getRolePermissions(Role $role) { $cacheId = sprintf('roles/%s', $role->getRoleName()); $item = $this->pool->getItem($cacheId); $permissions = $item->get(); if ($item->isMiss()) { $item->lock(); $permissions = $this->driver->getRolePermissions($role); $item->set($permissions); } return $permissions; }