コード例 #1
0
ファイル: UserContext.php プロジェクト: byjg/authuser
 protected function __construct()
 {
     try {
         $this->session = CacheContext::factory(self::SESSION_PREFIX);
     } catch (Exception $ex) {
         $this->session = new SessionCacheEngine();
         $this->session->configKey = self::SESSION_PREFIX;
     }
 }
コード例 #2
0
ファイル: ForkHandler.php プロジェクト: byjg/phpthread
 /**
  * Get the thread result from the shared memory block and erase it
  *
  * @return mixed
  * @throws \Error
  * @throws object
  */
 public function getResult()
 {
     if (is_null($this->threadKey)) {
         return null;
     }
     $key = $this->threadKey;
     $this->threadKey = null;
     $cache = CacheContext::factory('phpthread');
     $result = $cache->get($key);
     $cache->release($key);
     if (is_object($result) && (is_subclass_of($result, '\\Error') || is_subclass_of($result, '\\Exception'))) {
         throw $result;
     }
     return $result;
 }