Skip to content

Smarty_Internal_CacheResource_File

This class does contain all necessary methods for the HTML cache on file system Implements the file system as resource for the HTML cache Version ussing nocache inserts.

Methods

populate

populate Cached Object with meta data from Resource

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

Parameters:

Parameter Type Description
$cached \Smarty_Template_Cached cached object
$_template \Smarty_Internal_Template template object

populateTimestamp

populate Cached Object with timestamp and exists from Resource

public populateTimestamp(\Smarty_Template_Cached $cached): void

Parameters:

Parameter Type Description
$cached \Smarty_Template_Cached cached object

process

Read the cached template and process its header

public process(\Smarty_Internal_Template $_smarty_tpl, \Smarty_Template_Cached $cached = null, bool $update = false): bool

Parameters:

Parameter Type Description
$_smarty_tpl \Smarty_Internal_Template do not change variable name, is used by compiled template
$cached \Smarty_Template_Cached cached object
$update bool flag if called because cache update

Return Value:

true or false if the cached content does not exist


writeCachedContent

Write the rendered template output to cache

public writeCachedContent(\Smarty_Internal_Template $_template, string $content): bool

Parameters:

Parameter Type Description
$_template \Smarty_Internal_Template template object
$content string content to cache

Return Value:

success

Throws:


readCachedContent

Read cached template from cache

public readCachedContent(\Smarty_Internal_Template $_template): string

Parameters:

Parameter Type Description
$_template \Smarty_Internal_Template template object

Return Value:

content


clearAll

Empty cache

public clearAll(\Smarty $smarty, int $exp_time = null): int

Parameters:

Parameter Type Description
$smarty \Smarty
$exp_time int expiration time (number of seconds, not timestamp)

Return Value:

number of cache files deleted


clear

Empty cache for a specific template

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

Parameters:

Parameter Type Description
$smarty \Smarty
$resource_name string template name
$cache_id string cache id
$compile_id string compile id
$exp_time int expiration time (number of seconds, not timestamp)

Return Value:

number of cache files deleted


hasLock

Check is cache is locked for this template

public hasLock(\Smarty $smarty, \Smarty_Template_Cached $cached): bool

Parameters:

Parameter Type Description
$smarty \Smarty Smarty object
$cached \Smarty_Template_Cached cached object

Return Value:

true or false if cache is locked


acquireLock

Lock cache for this template

public acquireLock(\Smarty $smarty, \Smarty_Template_Cached $cached): bool|void

Parameters:

Parameter Type Description
$smarty \Smarty Smarty object
$cached \Smarty_Template_Cached cached object

releaseLock

Unlock cache for this template

public releaseLock(\Smarty $smarty, \Smarty_Template_Cached $cached): bool|void

Parameters:

Parameter Type Description
$smarty \Smarty Smarty object
$cached \Smarty_Template_Cached cached object

Inherited methods

populate

populate Cached Object with meta data from Resource

public populate(\Smarty_Template_Cached $cached, \Smarty_Internal_Template $_template): void
  • This method is abstract.

Parameters:

Parameter Type Description
$cached \Smarty_Template_Cached cached object
$_template \Smarty_Internal_Template template object

populateTimestamp

populate Cached Object with timestamp and exists from Resource

public populateTimestamp(\Smarty_Template_Cached $cached): void
  • This method is abstract.

Parameters:

Parameter Type Description
$cached \Smarty_Template_Cached

process

Read the cached template and process header

public process(\Smarty_Internal_Template $_template, \Smarty_Template_Cached $cached = null, bool $update = false): bool
  • This method is abstract.

Parameters:

Parameter Type Description
$_template \Smarty_Internal_Template template object
$cached \Smarty_Template_Cached cached object
$update bool flag if called because cache update

Return Value:

true or false if the cached content does not exist


writeCachedContent

Write the rendered template output to cache

public writeCachedContent(\Smarty_Internal_Template $_template, string $content): bool
  • This method is abstract.

Parameters:

Parameter Type Description
$_template \Smarty_Internal_Template template object
$content string content to cache

Return Value:

success


readCachedContent

Read cached template from cache

public readCachedContent(\Smarty_Internal_Template $_template): string
  • This method is abstract.

Parameters:

Parameter Type Description
$_template \Smarty_Internal_Template template object

Return Value:

content


getCachedContent

Return cached content

public getCachedContent(\Smarty_Internal_Template $_template): null|string

Parameters:

Parameter Type Description
$_template \Smarty_Internal_Template template object

clearAll

Empty cache

public clearAll(\Smarty $smarty, int $exp_time = null): int
  • This method is abstract.

Parameters:

Parameter Type Description
$smarty \Smarty Smarty object
$exp_time int expiration time (number of seconds, not timestamp)

Return Value:

number of cache files deleted


clear

Empty cache for a specific template

public clear(\Smarty $smarty, string $resource_name, string $cache_id, string $compile_id, int $exp_time): int
  • This method is abstract.

Parameters:

Parameter Type Description
$smarty \Smarty Smarty object
$resource_name string template name
$cache_id string cache id
$compile_id string compile id
$exp_time int expiration time (number of seconds, not timestamp)

Return Value:

number of cache files deleted


locked

public locked(\Smarty $smarty, \Smarty_Template_Cached $cached): bool|null

Parameters:

Parameter Type Description
$smarty \Smarty
$cached \Smarty_Template_Cached

hasLock

Check is cache is locked for this template

public hasLock(\Smarty $smarty, \Smarty_Template_Cached $cached): bool

Parameters:

Parameter Type Description
$smarty \Smarty
$cached \Smarty_Template_Cached

acquireLock

Lock cache for this template

public acquireLock(\Smarty $smarty, \Smarty_Template_Cached $cached): bool

Parameters:

Parameter Type Description
$smarty \Smarty
$cached \Smarty_Template_Cached

releaseLock

Unlock cache for this template

public releaseLock(\Smarty $smarty, \Smarty_Template_Cached $cached): bool

Parameters:

Parameter Type Description
$smarty \Smarty
$cached \Smarty_Template_Cached

load

Load Cache Resource Handler

public static load(\Smarty $smarty, string $type = null): \Smarty_CacheResource
  • This method is static.

Parameters:

Parameter Type Description
$smarty \Smarty Smarty object
$type string name of the cache resource

Return Value:

Cache Resource Handler

Throws:



Automatically generated on 2025-03-18