httpCache
in package
Table of Contents
Constants
- DEFAULT_EXPIRE = 604800
- DEFAULT_TYPE = "text/html"
Methods
- checkMTime() : mixed
- Check if given modification time is newer than client-side one. If not, the method will tell the client to get the content from its own cache.
- content() : mixed
- Cache the given $content with $mtime modification time.
- file() : mixed
- Cache a file. The $type parameter might define the MIME type of the file or path to magic file to autodetect the MIME type. If you skip $type parameter the method will try with the default magic file. Autodetection of MIME type requires Fileinfo PHP extension used in file::getMimeType()
Constants
DEFAULT_EXPIRE
public
mixed
DEFAULT_EXPIRE
= 604800
DEFAULT_TYPE
public
mixed
DEFAULT_TYPE
= "text/html"
Methods
checkMTime()
Check if given modification time is newer than client-side one. If not, the method will tell the client to get the content from its own cache.
public
static checkMTime(int $mtime[, mixed $sendHeaders = null ]) : mixed
Afterwards the script process will be terminated. This feature requires the PHP to be configured as Apache module.
Parameters
- $mtime : int
- $sendHeaders : mixed = null
content()
Cache the given $content with $mtime modification time.
public
static content(binary $content, int $mtime[, string $type = null ][, int $expire = null ][, array<string|int, mixed> $headers = null ][, bool $checkMTime = true ]) : mixed
Parameters
- $content : binary
- $mtime : int
- $type : string = null
- $expire : int = null
- $headers : array<string|int, mixed> = null
- $checkMTime : bool = true
file()
Cache a file. The $type parameter might define the MIME type of the file or path to magic file to autodetect the MIME type. If you skip $type parameter the method will try with the default magic file. Autodetection of MIME type requires Fileinfo PHP extension used in file::getMimeType()
public
static file(string $file[, string $type = null ][, int $expire = null ][, array<string|int, mixed> $headers = null ]) : mixed
Parameters
- $file : string
- $type : string = null
- $expire : int = null
- $headers : array<string|int, mixed> = null