class CacheLoader extends Loader

CacheLoader is a loader that caches other loaders responses on the filesystem.

This cache only caches on disk to allow PHP accelerators to cache the opcodes. All other mechanism would imply the use of eval().

Properties

protected LoggerInterface|null $logger from Loader
protected $debugger from Loader
protected $loader
protected $dir

Methods

setLogger(LoggerInterface $logger)

Sets the debug logger to use for this loader.

from Loader
setDebugger(DebuggerInterface $debugger) deprecated

Sets the debugger to use for this loader.

from Loader
__construct(LoaderInterface $loader, string $dir)

No description

Storage|bool
load(TemplateReferenceInterface $template)

Loads a template.

bool
isFresh(TemplateReferenceInterface $template, int $time)

Returns true if the template is still fresh.

Details

in Loader at line 37
setLogger(LoggerInterface $logger)

Sets the debug logger to use for this loader.

Parameters

LoggerInterface $logger

in Loader at line 49
setDebugger(DebuggerInterface $debugger) deprecated

deprecated since version 2.4, to be removed in 3.0. Use $this->setLogger() instead.

Sets the debugger to use for this loader.

Parameters

DebuggerInterface $debugger A debugger instance

at line 36
__construct(LoaderInterface $loader, string $dir)

Parameters

LoaderInterface $loader A Loader instance
string $dir The directory where to store the cache files

at line 47
Storage|bool load(TemplateReferenceInterface $template)

Loads a template.

Parameters

TemplateReferenceInterface $template

Return Value

Storage|bool false if the template cannot be loaded, a Storage instance otherwise

at line 95
bool isFresh(TemplateReferenceInterface $template, int $time)

Returns true if the template is still fresh.

Parameters

TemplateReferenceInterface $template A template
int $time The last modification time of the cached template (timestamp)

Return Value

bool