public function execute(Request $request)
    {
        if (!$this->requireProvider("Executing cache request")) return null;

        $cacheKey = $request->getCacheKey();

        if (empty($cacheKey)) {
            if (!empty($this->log)) $this->log->error("Invalid or missing cache key.");
            return null;
        }

        $cacheRefresh = $request->getForceRefresh();

        if (!$cacheRefresh) {
            $cacheData = $this->cacheProvider->get($cacheKey);

            if (!empty($cacheData)) {
                if (!empty($this->log)) $this->log->debug("Cache hit on key " . $cacheKey);

                return $cacheData;
            }
        }

        if (!empty($this->log)) $this->log->debug("CACHE", "Cache miss on key " . $cacheKey);

        $value = $request->executeCallback();

        if (!empty($value)) {
            $this->cacheProvider->set($cacheKey, $value, $request->getCacheTTL());
        }

        return $value;
    }
public function execute(Request $request)
    {
        if (!$this->requireProvider("Executing cache request")) return null;

        $cacheKey = $request->getCacheKey();

        if (empty($cacheKey)) {
            if (!empty($this->log)) $this->log->error("Invalid or missing cache key.");
            return null;
        }

        $cacheRefresh = $request->getForceRefresh();

        if (!$cacheRefresh) {
            $cacheData = $this->cacheProvider->get($cacheKey);

            if (!empty($cacheData)) {
                if (!empty($this->log)) $this->log->debug("Cache hit on key " . $cacheKey);

                return $cacheData;
            }
        }

        if (!empty($this->log)) $this->log->debug("CACHE", "Cache miss on key " . $cacheKey);

        $value = $request->executeCallback();

        if (!empty($value)) {
            $this->cacheProvider->set($cacheKey, $value, $request->getCacheTTL());
        }

        return $value;
    }
public function execute ( Request $ request ) { if ( ! $ this -> requireProvider ( "Executing cache request" ) ) return null ; $ cacheKey = $ request -> getCacheKey ( ) ; if ( empty ( $ cacheKey ) ) { if ( ! empty ( $ this -> log ) ) $ this -> log -> error ( "Invalid or missing cache key." ) ; return null ; } $ cacheRefresh = $ request -> getForceRefresh ( ) ; if ( ! $ cacheRefresh ) { $ cacheData = $ this -> cacheProvider -> get ( $ cacheKey ) ; if ( ! empty ( $ cacheData ) ) { if ( ! empty ( $ this -> log ) ) $ this -> log -> debug ( "Cache hit on key " . $ cacheKey ) ; return $ cacheData ; } } if ( ! empty ( $ this -> log ) ) $ this -> log -> debug ( "CACHE" , "Cache miss on key " . $ cacheKey ) ; $ value = $ request -> executeCallback ( ) ; if ( ! empty ( $ value ) ) { $ this -> cacheProvider -> set ( $ cacheKey , $ value , $ request -> getCacheTTL ( ) ) ; } return $ value ; }
Do a cache request

@param Request $request
@return mixed
Do a cache request