ResponseCacheItem
in package
Description of ResponseCacheItem
Tags
Table of Contents
Constants
- ETAG_HASH = 'xxh128'
- OUTPUT_CHUNK = 1048576
Properties
- $body : string
- $etag : string
- $file : bool
- $headers : array<string|int, mixed>
- $hit : bool
- $lastModified : string
- $responseCode : int
Methods
- __construct() : mixed
- deserialize() : self
- send() : void
- serialize() : string
- withHit() : self
- Helper for tests
- withLastModified() : self
- Helper for tests
- getFileHash() : string
- sendCompressed() : void
Constants
ETAG_HASH
public
mixed
ETAG_HASH
= 'xxh128'
OUTPUT_CHUNK
public
mixed
OUTPUT_CHUNK
= 1048576
Properties
$body read-only
public
string
$body
= ''
$etag read-only
public
string
$etag
$file read-only
public
bool
$file
= false
$headers
public
array<string|int, mixed>
$headers
= []
$hit read-only
public
bool
$hit
= false
$lastModified read-only
public
string
$lastModified
$responseCode read-only
public
int
$responseCode
= 0
Methods
__construct()
public
__construct([string $body = '' ][, int $responseCode = 0 ][, array<string, string|array<string|int, string>> $headers = [] ][, bool $hit = false ][, bool $file = false ][, string $etag = '' ][, string $lastModified = '' ]) : mixed
Parameters
- $body : string = ''
- $responseCode : int = 0
- $headers : array<string, string|array<string|int, string>> = []
- $hit : bool = false
- $file : bool = false
- $etag : string = ''
- $lastModified : string = ''
deserialize()
public
static deserialize(string $data) : self
Parameters
- $data : string
Return values
selfsend()
public
send([bool $compress = true ]) : void
Parameters
- $compress : bool = true
serialize()
public
serialize() : string
Return values
stringwithHit()
Helper for tests
public
withHit(bool $hit) : self
Parameters
- $hit : bool
Return values
selfwithLastModified()
Helper for tests
public
withLastModified(string $lastModified) : self
Parameters
- $lastModified : string
Return values
selfgetFileHash()
private
getFileHash() : string
Return values
stringsendCompressed()
private
sendCompressed(string $encoding) : void
Parameters
- $encoding : string