Exemple #1
0
 /**
  * @param $featureName
  * @return null|\SplitIO\Grammar\Split
  */
 private function getCachedFeature($featureName)
 {
     $ikey = $this->getSmKey($featureName);
     $value = null;
     try {
         $value = SharedMemory::read($ikey, $this->smMode, $this->smSize);
         if (!$value instanceof Split) {
             return null;
         }
     } catch (SupportSharedMemoryException $se) {
         SplitApp::logger()->warning($se->getMessage());
     } catch (OpenSharedMemoryException $oe) {
         SplitApp::logger()->warning($oe->getMessage());
     } catch (ReadSharedMemoryException $re) {
         SplitApp::logger()->error($re->getMessage());
     } catch (\Exception $e) {
         SplitApp::logger()->error($e->getMessage());
     }
     return $value;
 }
Exemple #2
0
 /**
  * @param $segmentName
  * @param $key
  * @return bool|null
  */
 private function isInCachedSegment($segmentName, $key)
 {
     $ikey = $this->getSmKey($segmentName, $key);
     $value = null;
     try {
         $value = SharedMemory::read($ikey, $this->smMode, $this->smSize);
         if (!is_bool($value)) {
             return null;
         }
     } catch (SupportSharedMemoryException $se) {
         SplitApp::logger()->warning($se->getMessage());
     } catch (OpenSharedMemoryException $oe) {
         SplitApp::logger()->warning($oe->getMessage());
     } catch (ReadSharedMemoryException $re) {
         SplitApp::logger()->error($re->getMessage());
     } catch (\Exception $e) {
         SplitApp::logger()->error($e->getMessage());
     }
     return $value;
 }