<?php
namespace Blazemedia\Affiliation\Utils;

class HttpCachedRequest extends HttpRequest{

    public static function getCachedContent(string $apicall, string $transientKey){

        $cachedData = get_transient($transientKey);

        if (false === $cachedData) {
            $apiData = parent::getContent($apicall);

            set_transient($transientKey, $apiData, 3600);

            $cachedData = $apiData;
        }

        return $cachedData;
    }
}