src/Strategy/PrivateCacheStrategy.php
protected function getCacheKey(RequestInterface $request, KeyValueHttpHeader $varyHeaders = null)
    {
        if (!$varyHeaders) {
            return hash('sha256', $request->getMethod().$request->getUri());
        }

        $cacheHeaders = [];

        foreach ($varyHeaders as $key => $value) {
            if ($request->hasHeader($key)) {
                $cacheHeaders[$key] = $request->getHeader($key);
            }
        }

        return hash('sha256', $request->getMethod().$request->getUri().json_encode($cacheHeaders));
    }
protected function getCacheKey(RequestInterface $request, KeyValueHttpHeader $varyHeaders = null)
    {
        if (!$varyHeaders) {
            return hash('sha256', $request->getMethod().$request->getUri());
        }

        $cacheHeaders = [];

        foreach ($varyHeaders as $key => $value) {
            if ($request->hasHeader($key)) {
                $cacheHeaders[$key] = $request->getHeader($key);
            }
        }

        return hash('sha256', $request->getMethod().$request->getUri().json_encode($cacheHeaders));
    }
protected function getCacheKey ( RequestInterface $ request , KeyValueHttpHeader $ varyHeaders = null ) { if ( ! $ varyHeaders ) { return hash ( 'sha256' , $ request -> getMethod ( ) . $ request -> getUri ( ) ) ; } $ cacheHeaders = [ ] ; foreach ( $ varyHeaders as $ key => $ value ) { if ( $ request -> hasHeader ( $ key ) ) { $ cacheHeaders [ $ key ] = $ request -> getHeader ( $ key ) ; } } return hash ( 'sha256' , $ request -> getMethod ( ) . $ request -> getUri ( ) . json_encode ( $ cacheHeaders ) ) ; }
Generate a key for the response cache.

@param RequestInterface   $request
@param null|KeyValueHttpHeader $varyHeaders The vary headers which should be honoured by the cache (optional)

@return string
Generate a key for the response cache .