Webiny\Component\Rest\Response\Cache::saveCallbackResult PHP Method

saveCallbackResult() public method

Saves the result into cache.
public saveCallbackResult ( mixed $result ) : boolean
$result mixed Result that should be saved.
return boolean
    public function saveCallbackResult($result)
    {
        // get cache key
        $cacheKey = $this->getCacheKey();
        // cache the result
        try {
            $cache = $this->cache($this->requestBag->getApiConfig()->get('Cache'));
            return $cache->save($cacheKey, $result, $this->requestBag->getMethodData()['cache']['ttl']);
        } catch (\Exception $e) {
            throw new RestException('Unable to save the result into cache. ' . $e->getMessage());
        }
    }