/**
  * {@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;
 }
Exemplo n.º 2
0
 /**
  * {@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;
 }
Exemplo n.º 3
0
 /**
  * Creates a key to store the role's permissions
  *
  * @param \BeatSwitch\Lock\Roles\Role $role
  * @return string
  */
 private function getRoleKey(Role $role)
 {
     return 'role_' . $role->getRoleName();
 }