Added \ncc\Objects > HttpResponseCache

This commit is contained in:
Netkas 2022-12-15 17:48:03 -05:00
parent 54b733caf7
commit 6d35e42106

View file

@ -0,0 +1,56 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace ncc\Objects;
use ncc\Utilities\RuntimeCache;
class HttpResponseCache
{
/**
* The cache of response
*
* @var HttpResponse
*/
private $httpResponse;
/**
* The Unix Timestamp of when the cache becomes invalid
*
* @var int
*/
private $ttl;
/**
* Creates a new HttpResponseCache
*
* @param HttpResponse $httpResponse
* @param int $ttl
*/
public function __construct(HttpResponse $httpResponse, int $ttl)
{
$this->httpResponse = $httpResponse;
$this->ttl = $ttl;
}
/**
* Returns the cached response
*
* @return HttpResponse
*/
public function getHttpResponse(): HttpResponse
{
return $this->httpResponse;
}
/**
* Returns the Unix Timestamp of when the cache becomes invalid
*
* @return int
*/
public function getTtl(): int
{
return $this->ttl;
}
}