Smarty Cache Handler Base for Key/Value Storage Implementations
This class implements the functionality required to use simple key/value stores for hierarchical cache groups. key/value stores like memcache or APC do not support wildcards in keys, therefore a cache group cannot be cleared like "a|*" - which is no problem to filesystem and RDBMS implementations.
This implementation is based on the concept of invalidation. While one specific cache can be identified and cleared, any range of caches cannot be identified. For this reason each level of the cache group hierarchy can have its own value in the store. These values are nothing but microtimes, telling us when a particular cache group was cleared for the last time. These keys are evaluated for every cache read to determine if the cache has been invalidated since it was created and should hence be treated as inexistent.
Although deep hierarchies are possible, they are not recommended. Try to keep your cache groups as shallow as possible. Anything up 3-5 parents should be ok. So »a|b|c« is a good depth where »a|b|c|d|e|f|g|h|i|j|k« isn't. Try to join correlating cache groups: if your cache groups look somewhat like »a|b|$page|$items|$whatever« consider using »a|b|c|$page-$items-$whatever« instead.
Located in /libs/sysplugins/smarty_cacheresource_keyvaluestore.php (line 34)
Smarty_CacheResource | --Smarty_CacheResource_KeyValueStore
Class | Description |
---|---|
Smarty_CacheResource_Apc | APC CacheResource |
Smarty_CacheResource_Memcache | Memcache CacheResource |
cache for contents
cache for timestamps
Inherited from Smarty_CacheResource
Smarty_CacheResource::$resources
Smarty_CacheResource::$sysplugins
Lock cache for this template
Add current microtime to the beginning of $cache_content
Empty cache for a specific template
Empty cache
Remove values from cache
Fetch and prepare a cache object.
Determine the latest timestamp known to the invalidation chain
Extract the timestamp the $content was cached
Get template's unique ID
Check is cache is locked for this template
Invalidate CacheID
Translate a CacheID into the list of applicable InvalidationKeys.
Splits "some|chain|into|an|array" into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... )
populate Cached Object with meta data from Resource
populate Cached Object with timestamp and exists from Resource
Read the cached template and process the header
Remove *all* values from cache
Read values for a set of keys from cache
Unlock cache for this template
Sanitize CacheID components
Save values for a set of keys to cache
Write the rendered template output to cache
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:34 +0200 by phpDocumentor 1.4.1