Interface Twig_CacheInterface

Implemented byTwig_Cache_Filesystem, Twig_Cache_Null

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.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
generateKey() Generates a cache key for the given template class name. Twig_CacheInterface
getTimestamp() Returns the modification timestamp of a key. Twig_CacheInterface
load() Loads a template from the cache. Twig_CacheInterface
write() Writes the compiled template to cache. Twig_CacheInterface

Method Details

generateKey() public abstract method

Generates a cache key for the given template class name.

public abstract string generateKey ( $name, $className )
$name string

The template name

$className string

The template class name

getTimestamp() public abstract method

Returns the modification timestamp of a key.

public abstract int getTimestamp ( $key )
$key string

The cache key

load() public abstract method

Loads a template from the cache.

public abstract void load ( $key )
$key string

The cache key

write() public abstract method

Writes the compiled template to cache.

public abstract void write ( $key, $content )
$key string

The cache key

$content string

The template representation as a PHP class