PHP Class Webiny\Component\Rest\Response\Cache

It is also used to acquire the cache key.
Inheritance: use trait Webiny\Component\Http\HttpTrait, use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\Cache\CacheTrait
Show file Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( RequestBag $requestBag ) Base constructor.
getCallbackResultFromCache ( ) : boolean | mixed Tries to get the result for the given api request from the cache.
getFromCache ( RequestBag $requestBag ) : boolean | mixed Tries to get the result for the given api request from the cache.
purgeCacheResult ( ) : boolean Purges the cached result.
purgeResult ( RequestBag $requestBag ) : boolean Purges the cached result.
saveCallbackResult ( mixed $result ) : boolean Saves the result into cache.
saveResult ( RequestBag $requestBag, mixed $result ) : boolean Saves the result from the given api request into cache.

Private Methods

Method Description
getCacheKey ( ) : string Computes the cache key, or gets it from the implemented interface from the api class.

Method Details

__construct() public method

Base constructor.
public __construct ( RequestBag $requestBag )
$requestBag RequestBag

getCallbackResultFromCache() public method

Tries to get the result for the given api request from the cache.
public getCallbackResultFromCache ( ) : boolean | mixed
return boolean | mixed False or the actual result from cache.

getFromCache() public static method

Tries to get the result for the given api request from the cache.
public static getFromCache ( RequestBag $requestBag ) : boolean | mixed
$requestBag RequestBag
return boolean | mixed False or the actual result from cache.

purgeCacheResult() public method

Purges the cached result.
public purgeCacheResult ( ) : boolean
return boolean

purgeResult() public static method

Purges the cached result.
public static purgeResult ( RequestBag $requestBag ) : boolean
$requestBag RequestBag
return boolean

saveCallbackResult() public method

Saves the result into cache.
public saveCallbackResult ( mixed $result ) : boolean
$result mixed Result that should be saved.
return boolean

saveResult() public static method

Saves the result from the given api request into cache.
public static saveResult ( RequestBag $requestBag, mixed $result ) : boolean
$requestBag RequestBag
$result mixed
return boolean