Cache Handler API

package Smarty
subpackage Cacher
author Rodney Rehm

 Methods

Lock cache for this template

acquireLock(\Smarty $smarty, \Smarty_Template_Cached $cached) 

Parameters

$smarty

\Smarty

Smarty object

$cached

\Smarty_Template_Cached

cached object

Empty cache for a specific template

clear(\Smarty $smarty, string $resource_name, string $cache_id, string $compile_id, integer $exp_time) : integer

Parameters

$smarty

\Smarty

Smarty object

$resource_name

string

template name

$cache_id

string

cache id

$compile_id

string

compile id

$exp_time

integer

expiration time (number of seconds, not timestamp)

Returns

integernumber of cache files deleted

Empty cache

clearAll(\Smarty $smarty, integer $exp_time) : integer

Parameters

$smarty

\Smarty

Smarty object

$exp_time

integer

expiration time (number of seconds, not timestamp)

Returns

integernumber of cache files deleted

Return cached content

getCachedContent(\Smarty_Internal_Template $_template) 
Inherited
inherited_from \Smarty_CacheResource::getCachedContent()

Parameters

$_template

\Smarty_Internal_Template

template object

Check is cache is locked for this template

hasLock(\Smarty $smarty, \Smarty_Template_Cached $cached) : \booelan

Parameters

$smarty

\Smarty

Smarty object

$cached

\Smarty_Template_Cached

cached object

Returns

\booelantrue or false if cache is locked

Invalid Loaded Cache Files

invalidLoadedCache(\Smarty $smarty) 
InheritedStatic
inherited_from \Smarty_CacheResource::invalidLoadedCache()

Parameters

$smarty

\Smarty

Smarty object

Load Cache Resource Handler

load(\Smarty $smarty, string $type) : \Smarty_CacheResource
InheritedStatic
inherited_from \Smarty_CacheResource::load()

Parameters

$smarty

\Smarty

Smarty object

$type

string

name of the cache resource

Returns

\Smarty_CacheResourceCache Resource Handler

locked()

locked(\Smarty $smarty, \Smarty_Template_Cached $cached) 
Inherited
inherited_from \Smarty_CacheResource::locked()

Parameters

$smarty

$cached

populate Cached Object with meta data from Resource

populate(\Smarty_Template_Cached $cached, \Smarty_Internal_Template $_template) : void

Parameters

$cached

\Smarty_Template_Cached

cached object

$_template

\Smarty_Internal_Template

template object

populate Cached Object with timestamp and exists from Resource

populateTimestamp(\Smarty_Template_Cached $cached) : void

Parameters

$cached

Read the cached template and process the header

process(\Smarty_Internal_Template $_template, \Smarty_Template_Cached $cached) : \booelan

Parameters

$_template

\Smarty_Internal_Template

template object

$cached

\Smarty_Template_Cached

cached object

Returns

\booelantrue or false if the cached content does not exist

Unlock cache for this template

releaseLock(\Smarty $smarty, \Smarty_Template_Cached $cached) 

Parameters

$smarty

\Smarty

Smarty object

$cached

\Smarty_Template_Cached

cached object

Write the rendered template output to cache

writeCachedContent(\Smarty_Internal_Template $_template, string $content) : boolean

Parameters

$_template

\Smarty_Internal_Template

template object

$content

string

content to cache

Returns

booleansuccess

Delete content from cache

delete(string $name, string $cache_id, string $compile_id, integer | null $exp_time) : integer

Parameters

$name

string

template name

$cache_id

string

cache id

$compile_id

string

compile id

$exp_time

integernull

seconds till expiration time in seconds or null

Returns

integernumber of deleted caches

fetch cached content and its modification time from data source

fetch(string $id, string $name, string $cache_id, string $compile_id, string $content, integer $mtime) : void

Parameters

$id

string

unique cache content identifier

$name

string

template name

$cache_id

string

cache id

$compile_id

string

compile id

$content

string

cached content

$mtime

integer

cache modification timestamp (epoch)

Fetch cached content's modification timestamp from data source

fetchTimestamp(string $id, string $name, string $cache_id, string $compile_id) : integer | boolean

{@internal implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content.}}

Parameters

$id

string

unique cache content identifier

$name

string

template name

$cache_id

string

cache id

$compile_id

string

compile id

Returns

integerbooleantimestamp (epoch) the template was modified, or false if not found

Save content to cache

save(string $id, string $name, string $cache_id, string $compile_id, integer | null $exp_time, string $content) : boolean

Parameters

$id

string

unique cache content identifier

$name

string

template name

$cache_id

string

cache id

$compile_id

string

compile id

$exp_time

integernull

seconds till expiration or null

$content

string

content to cache

Returns

booleansuccess

 Properties

 

$resources : array
Inherited
inherited_from \Smarty_CacheResource::$$resources
 

$sysplugins : array
Inherited
inherited_from \Smarty_CacheResource::$$sysplugins