public function getItem(string $key, int $forceStaticCacheHitCounter = 0)
    {
        if (!$this->adapter instanceof iAdapter) {
            return null;
        }

        $storeKey = $this->calculateStoreKey($key);

        // check if we already using static-cache
        $useStaticCache = true;
        if ($this->adapter instanceof AdapterArray) {
            $useStaticCache = false;
        }

        if (!isset(self::$STATIC_CACHE_COUNTER[$storeKey])) {
            self::$STATIC_CACHE_COUNTER[$storeKey] = 0;
        }

        // get from static-cache
        if (
            $useStaticCache
            &&
            $this->checkForStaticCache($storeKey)
        ) {
            return self::$STATIC_CACHE[$storeKey];
        }

        $serialized = $this->adapter->get($storeKey);
        $value = $serialized && $this->serializer ? $this->serializer->unserialize($serialized) : null;

        self::$STATIC_CACHE_COUNTER[$storeKey]++;

        // save into static-cache if needed
        if (
            $useStaticCache
            &&
            (
                (
                    $forceStaticCacheHitCounter !== 0
                    &&
                    self::$STATIC_CACHE_COUNTER[$storeKey] >= $forceStaticCacheHitCounter
                )
                ||
                (
                    $this->staticCacheHitCounter !== 0
                    &&
                    self::$STATIC_CACHE_COUNTER[$storeKey] >= $this->staticCacheHitCounter
                )
            )
        ) {
            self::$STATIC_CACHE[$storeKey] = $value;
        }

        return $value;
    }
public function getItem(string $key, int $forceStaticCacheHitCounter = 0)
    {
        if (!$this->adapter instanceof iAdapter) {
            return null;
        }

        $storeKey = $this->calculateStoreKey($key);

        // check if we already using static-cache
        $useStaticCache = true;
        if ($this->adapter instanceof AdapterArray) {
            $useStaticCache = false;
        }

        if (!isset(self::$STATIC_CACHE_COUNTER[$storeKey])) {
            self::$STATIC_CACHE_COUNTER[$storeKey] = 0;
        }

        // get from static-cache
        if (
            $useStaticCache
            &&
            $this->checkForStaticCache($storeKey)
        ) {
            return self::$STATIC_CACHE[$storeKey];
        }

        $serialized = $this->adapter->get($storeKey);
        $value = $serialized && $this->serializer ? $this->serializer->unserialize($serialized) : null;

        self::$STATIC_CACHE_COUNTER[$storeKey]++;

        // save into static-cache if needed
        if (
            $useStaticCache
            &&
            (
                (
                    $forceStaticCacheHitCounter !== 0
                    &&
                    self::$STATIC_CACHE_COUNTER[$storeKey] >= $forceStaticCacheHitCounter
                )
                ||
                (
                    $this->staticCacheHitCounter !== 0
                    &&
                    self::$STATIC_CACHE_COUNTER[$storeKey] >= $this->staticCacheHitCounter
                )
            )
        ) {
            self::$STATIC_CACHE[$storeKey] = $value;
        }

        return $value;
    }
public function getItem ( string $ key , int $ forceStaticCacheHitCounter = 0 ) { if ( ! $ this -> adapter instanceof iAdapter ) { return null ; } $ storeKey = $ this -> calculateStoreKey ( $ key ) ; // check if we already using static-cache $ useStaticCache = true ; if ( $ this -> adapter instanceof AdapterArray ) { $ useStaticCache = false ; } if ( ! isset ( self :: $ STATIC_CACHE_COUNTER [ $ storeKey ] ) ) { self :: $ STATIC_CACHE_COUNTER [ $ storeKey ] = 0 ; } // get from static-cache if ( $ useStaticCache && $ this -> checkForStaticCache ( $ storeKey ) ) { return self :: $ STATIC_CACHE [ $ storeKey ] ; } $ serialized = $ this -> adapter -> get ( $ storeKey ) ; $ value = $ serialized && $ this -> serializer ? $ this -> serializer -> unserialize ( $ serialized ) : null ; self :: $ STATIC_CACHE_COUNTER [ $ storeKey ] ++ ; // save into static-cache if needed if ( $ useStaticCache && ( ( $ forceStaticCacheHitCounter !== 0 && self :: $ STATIC_CACHE_COUNTER [ $ storeKey ] >= $ forceStaticCacheHitCounter ) || ( $ this -> staticCacheHitCounter !== 0 && self :: $ STATIC_CACHE_COUNTER [ $ storeKey ] >= $ this -> staticCacheHitCounter ) ) ) { self :: $ STATIC_CACHE [ $ storeKey ] = $ value ; } return $ value ; }
Get cached-item by key.

@param string $key
@param int    $forceStaticCacheHitCounter

@return mixed
Get cached - item by key .