Cache
class Cache (View source)
Constants
| CACHED |
|
| FAILED |
|
| WRITING |
|
| DEFAULT_CHUNK_SIZE |
|
Methods
Define HTTP and request target. By default, the query string is not used; combine INPHINIT_PATH with $_SERVER[QUERY_STRING].
No description
Set storage location
Starts recording the buffer to the cache, or serves it directly if a fresh copy exists.
Stops the cache and writes the content and headers obtained so far
Note: Under normal circumstances, __destruct will execute this method automatically
No description
Create hash used by cache name and Etag header - This method can be overridden
Check If-None-Match with ETag and If-Modified-Since with cache modified datetim
Checks if the HTTP status code and method are valid for caching – This method can be overridden.
Details
__construct(string|null $method = null, string|null $target = null, string|null $query = null)
Define HTTP and request target. By default, the query string is not used; combine INPHINIT_PATH with $_SERVER[QUERY_STRING].
setLifetime($days, $hours, $minutes)
No description
setStorage(string $path)
Set storage location
int
start(int $chunkSize = null)
Starts recording the buffer to the cache, or serves it directly if a fresh copy exists.
- Returns
CACHEDand serves the stored response if a fresh cache exists - Returns
WRITINGif recording of the current response just started - Returns
FAILEDif the method/cache is not writable, or the cache could not be created
stop()
Stops the cache and writes the content and headers obtained so far
Note: Under normal circumstances, __destruct will execute this method automatically
__destruct()
No description
static protected string
createHash(string $path)
Create hash used by cache name and Etag header - This method can be overridden
static protected bool
match(string $etag, int $modified)
Check If-None-Match with ETag and If-Modified-Since with cache modified datetim
static protected bool
valid(int $status, string $method)
Checks if the HTTP status code and method are valid for caching – This method can be overridden.