protected function processGetResult($key, $result, $expire, $fn)
    {
        if (false === $result && ($expire || $fn)) {
            // Avoid using null as expire second, for null will be convert to 0
            // which means that store the cache forever, and make it hart to debug.
            if (!is_numeric($expire) && $fn) {
                throw new \InvalidArgumentException(sprintf(
                    'Expire time for cache "%s" must be numeric, %s given',
                    $key,
                    is_object($expire) ? get_class($expire) : gettype($expire)
                ));
            }

            // Example: get($key, function(){});
            if ($expire && !$fn) {
                $fn = $expire;
                $expire = 0;
            }

            $result = call_user_func($fn, $this->wei, $this);
            $this->set($key, $result, $expire);
        }
        return $result;
    }
protected function processGetResult($key, $result, $expire, $fn)
    {
        if (false === $result && ($expire || $fn)) {
            // Avoid using null as expire second, for null will be convert to 0
            // which means that store the cache forever, and make it hart to debug.
            if (!is_numeric($expire) && $fn) {
                throw new \InvalidArgumentException(sprintf(
                    'Expire time for cache "%s" must be numeric, %s given',
                    $key,
                    is_object($expire) ? get_class($expire) : gettype($expire)
                ));
            }

            // Example: get($key, function(){});
            if ($expire && !$fn) {
                $fn = $expire;
                $expire = 0;
            }

            $result = call_user_func($fn, $this->wei, $this);
            $this->set($key, $result, $expire);
        }
        return $result;
    }
protected function processGetResult ( $ key , $ result , $ expire , $ fn ) { if ( false === $ result && ( $ expire || $ fn ) ) { // Avoid using null as expire second, for null will be convert to 0 // which means that store the cache forever, and make it hart to debug. if ( ! is_numeric ( $ expire ) && $ fn ) { throw new \ InvalidArgumentException ( sprintf ( 'Expire time for cache "%s" must be numeric, %s given' , $ key , is_object ( $ expire ) ? get_class ( $ expire ) : gettype ( $ expire ) ) ) ; } // Example: get($key, function(){}); if ( $ expire && ! $ fn ) { $ fn = $ expire ; $ expire = 0 ; } $ result = call_user_func ( $ fn , $ this -> wei , $ this ) ; $ this -> set ( $ key , $ result , $ expire ) ; } return $ result ; }
Store data to cache when data is not false and callback is provided

@param string $key
@param mixed $result
@param int $expire
@param callable $fn
@throws \RuntimeException
@throws \InvalidArgumentException
@return mixed
Store data to cache when data is not false and callback is provided