コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getCallerPermissions(Caller $caller)
 {
     $cacheId = sprintf('callers/%s/%s', $caller->getCallerType(), $caller->getCallerId());
     $permissions = $this->cache->fetch($cacheId);
     if (!$this->cache->contains($cacheId)) {
         $permissions = $this->driver->getCallerPermissions($caller);
         $this->cache->save($cacheId, $permissions);
     }
     return $permissions;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function getCallerPermissions(Caller $caller)
 {
     $cacheId = sprintf('callers/%s/%s', $caller->getCallerType(), $caller->getCallerId());
     $item = $this->pool->getItem($cacheId);
     $permissions = $item->get();
     if ($item->isMiss()) {
         $item->lock();
         $permissions = $this->driver->getCallerPermissions($caller);
         $item->set($permissions);
     }
     return $permissions;
 }
コード例 #3
0
 /**
  * Creates a key to store the caller's permissions
  *
  * @param \BeatSwitch\Lock\Callers\Caller $caller
  * @return string
  */
 private function getCallerKey(Caller $caller)
 {
     return 'caller_' . $caller->getCallerType() . '_' . $caller->getCallerId();
 }