class Cache (View source)

Methods

void
__construct(int $expires = 900, int $modified = 0, string $prefix = '', bool $querystring = false)

Create a cache instance by route path

static bool
allowHeaders()

Check if is HEAD or GET, you can overwrite this method

void
finish()

Write cache

static bool
match(string $modified, string $etag = null)

Check HTTP_IF_MODIFIED_SINCE and HTTP_IF_NONE_MATCH from server If true you can send 304 Not Modified

bool
cached()

Checks if page (from route) is already cached.

string
write(string $data)

Write data in cache file.

void
show()

Show cache content from current page (from route) in output

Details

void __construct(int $expires = 900, int $modified = 0, string $prefix = '', bool $querystring = false)

Create a cache instance by route path

Parameters

int $expires
int $modified
string $prefix
bool $querystring

Return Value

void

static protected bool allowHeaders()

Check if is HEAD or GET, you can overwrite this method

Return Value

bool

void finish()

Write cache

Return Value

void

static bool match(string $modified, string $etag = null)

Check HTTP_IF_MODIFIED_SINCE and HTTP_IF_NONE_MATCH from server If true you can send 304 Not Modified

Parameters

string $modified
string $etag

Return Value

bool

bool cached()

Checks if page (from route) is already cached.

Return Value

bool

string write(string $data)

Write data in cache file.

This method returns the set value itself because the class uses ob_start

Parameters

string $data

Return Value

string

void show()

Show cache content from current page (from route) in output

Return Value

void