Documentation

CacheInterface

Interface implemented by cache classes.

It is highly recommended to always store templates on the filesystem to benefit from the PHP opcode cache. This interface is mostly useful if you need to implement a custom strategy for storing templates on the filesystem.

Tags
author

Andrew Tch andrew@noop.lv

Table of Contents

generateKey()  : string
Generates a cache key for the given template class name.
getTimestamp()  : int
Returns the modification timestamp of a key.
load()  : mixed
Loads a template from the cache.
write()  : mixed
Writes the compiled template to cache.

Methods

generateKey()

Generates a cache key for the given template class name.

public generateKey(string $name, string $className) : string
Parameters
$name : string

The template name

$className : string

The template class name

Return values
string

getTimestamp()

Returns the modification timestamp of a key.

public getTimestamp(string $key) : int
Parameters
$key : string

The cache key

Return values
int

load()

Loads a template from the cache.

public load(string $key) : mixed
Parameters
$key : string

The cache key

Return values
mixed

write()

Writes the compiled template to cache.

public write(string $key, string $content) : mixed
Parameters
$key : string

The cache key

$content : string

The template representation as a PHP class

Return values
mixed

Search results