Class Smarty_CacheResource_Mysql

Description

MySQL CacheResource

CacheResource Implementation based on the Custom API to use MySQL as the storage resource for Smarty's output caching.

Table definition:

CREATE TABLE IF NOT EXISTS `output_cache` (
   `id` CHAR(40) NOT NULL COMMENT 'sha1 hash',
   `name` VARCHAR(250) NOT NULL,
   `cache_id` VARCHAR(250) NULL DEFAULT NULL,
   `compile_id` VARCHAR(250) NULL DEFAULT NULL,
   `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `content` LONGTEXT NOT NULL,
   PRIMARY KEY (`id`),
   INDEX(`name`),
   INDEX(`cache_id`),
   INDEX(`compile_id`),
   INDEX(`modified`)
 ) ENGINE = InnoDB;

  • author: Rodney Rehm

Located in /demo/plugins/cacheresource.mysql.php (line 27)

Smarty_CacheResource
   |
   --Smarty_CacheResource_Custom
      |
      --Smarty_CacheResource_Mysql
Variable Summary
mixed $db
mixed $fetch
mixed $save
Method Summary
Smarty_CacheResource_Mysql __construct ()
integer delete (string $name, string $cache_id, string $compile_id, integer|null $exp_time)
void fetch (string $id, string $name, string $cache_id, string $compile_id,  &$content,  &$mtime, string $content, integer $mtime)
integer|boolean fetchTimestamp (string $id, string $name, string $cache_id, string $compile_id)
boolean save (string $id, string $name, string $cache_id, string $compile_id, integer|null $exp_time, string $content)
Variables
mixed $db (line 29)
  • access: protected
mixed $fetch (line 30)
  • access: protected
mixed $fetchTimestamp (line 31)
  • access: protected
mixed $save (line 32)
  • access: protected

Inherited Variables

Inherited from Smarty_CacheResource

Smarty_CacheResource::$resources
Smarty_CacheResource::$sysplugins
Methods
Constructor __construct (line 34)
  • access: public
Smarty_CacheResource_Mysql __construct ()
delete (line 121)

Delete content from cache

  • return: number of deleted caches
  • access: protected
integer delete (string $name, string $cache_id, string $compile_id, integer|null $exp_time)
  • string $name: template name
  • string $cache_id: cache id
  • string $compile_id: compile id
  • integer|null $exp_time: seconds till expiration or null

Redefinition of:
Smarty_CacheResource_Custom::delete()
Delete content from cache
fetch (line 57)

fetch cached content and its modification time from data source

  • access: protected
void fetch (string $id, string $name, string $cache_id, string $compile_id,  &$content,  &$mtime, string $content, integer $mtime)
  • string $id: unique cache content identifier
  • string $name: template name
  • string $cache_id: cache id
  • string $compile_id: compile id
  • string $content: cached content
  • integer $mtime: cache modification timestamp (epoch)
  • &$content
  • &$mtime

Redefinition of:
Smarty_CacheResource_Custom::fetch()
fetch cached content and its modification time from data source
fetchTimestamp (line 81)

Fetch cached content's modification timestamp from data source

  • return: timestamp (epoch) the template was modified, or false if not found
  • access: protected
integer|boolean fetchTimestamp (string $id, string $name, string $cache_id, string $compile_id)
  • string $id: unique cache content identifier
  • string $name: template name
  • string $cache_id: cache id
  • string $compile_id: compile id

Redefinition of:
Smarty_CacheResource_Custom::fetchTimestamp()
Fetch cached content's modification timestamp from data source
save (line 100)

Save content to cache

  • return: success
  • access: protected
boolean save (string $id, string $name, string $cache_id, string $compile_id, integer|null $exp_time, string $content)
  • string $id: unique cache content identifier
  • string $name: template name
  • string $cache_id: cache id
  • string $compile_id: compile id
  • integer|null $exp_time: seconds till expiration time in seconds or null
  • string $content: content to cache

Redefinition of:
Smarty_CacheResource_Custom::save()
Save content to cache

Inherited Methods

Inherited From Smarty_CacheResource_Custom

Smarty_CacheResource_Custom::clear()
Smarty_CacheResource_Custom::clearAll()
Smarty_CacheResource_Custom::delete()
Smarty_CacheResource_Custom::fetch()
Smarty_CacheResource_Custom::fetchTimestamp()
Smarty_CacheResource_Custom::populate()
Smarty_CacheResource_Custom::populateTimestamp()
Smarty_CacheResource_Custom::process()
Smarty_CacheResource_Custom::save()
Smarty_CacheResource_Custom::writeCachedContent()

Inherited From Smarty_CacheResource

Smarty_CacheResource::acquireLock()
Smarty_CacheResource::clear()
Smarty_CacheResource::clearAll()
Smarty_CacheResource::getCachedContent()
Smarty_CacheResource::hasLock()
Smarty_CacheResource::invalidLoadedCache()
Smarty_CacheResource::load()
Smarty_CacheResource::locked()
Smarty_CacheResource::populate()
Smarty_CacheResource::populateTimestamp()
Smarty_CacheResource::process()
Smarty_CacheResource::releaseLock()
Smarty_CacheResource::writeCachedContent()

Documentation generated on Sat, 24 Sep 2011 20:23:10 +0200 by phpDocumentor 1.4.1