Class TSqlMapCacheModel

Description

TSqlMapCacheModel corresponds to the <cacheModel> sql mapping configuration tag.

The results from a query Mapped Statement can be cached simply by specifying the CacheModel property in <statement> tag. A cache model is a configured cache that is defined within the sql map configuration file. Cache models are configured using the <cacheModel> element.

The cache model uses a pluggable framework for supporting different types of caches. The choice of cache is specified by the Implementation property. The class name specified must be one of TSqlMapCacheTypes.

The cache implementations, LRU and FIFO cache below do not persist across requests. That is, once the request is complete, all cache data is lost. These caches are useful queries that results in the same repeated data during the current request.

  • author: Wei Zhuo <weizho[at]gmail[dot]com>
  • version: $Id: TSqlMapCacheModel.php 3152 2012-05-29 10:01:36Z ctrlaltca $
  • since: 3.1

Located in /Data/SqlMap/Configuration/TSqlMapCacheModel.php (line 35)

TComponent
   |
   --TSqlMapCacheModel
Method Summary
static void registerCacheType ( $type,  $className)
void flush ()
mixed get (TSqlMapCacheKey|string $key)
integer getFlushInterval ()
float getHitRatio ()
string getID ()
string getImplementation ()
void initialize ([ISqLMapCache $cache = null])
void registerTriggerStatement (TMappedStatement $mappedStatement)
void set (TSqlMapCacheKey|string $key, mixed $value)
void setFlushInterval (integer $value)
void setID (string $value)
void setImplementation (string $value)
Methods
static method registerCacheType (line 47)
  • access: public
static void registerCacheType ( $type,  $className)
  • $type
  • $className
flush (line 143)

Clears the cache.

  • access: public
void flush ()
get (line 152)
  • return: cached value.
  • access: public
mixed get (TSqlMapCacheKey|string $key)
getFlushInterval (line 98)
  • return: cache duration.
  • access: public
integer getFlushInterval ()
getHitRatio (line 181)
  • return: cache hit ratio.
  • access: public
float getHitRatio ()
getID (line 55)
  • return: unique cache model identifier.
  • access: public
string getID ()
getImplementation (line 71)
  • return: cache implements of TSqlMapCacheTypes, either 'Basic', 'LRU' or 'FIFO'.
  • access: public
string getImplementation ()
getImplementationClass (line 118)
  • return: cache implementation class name.
  • access: public
string getImplementationClass ()
initialize (line 107)

Initialize the cache implementation, sets the actual cache contain if supplied.

  • access: public
void initialize ([ISqLMapCache $cache = null])
  • ISqLMapCache $cache: cache implementation instance.
registerTriggerStatement (line 135)

Register a mapped statement that will trigger a cache flush.

  • access: public
void registerTriggerStatement (TMappedStatement $mappedStatement)
set (line 169)
  • access: public
void set (TSqlMapCacheKey|string $key, mixed $value)
setFlushInterval (line 90)
  • access: public
void setFlushInterval (integer $value)
  • integer $value: the number of seconds in which the cached value will expire. 0 means never expire.
setID (line 63)
  • access: public
void setID (string $value)
  • string $value: unique cache model identifier.
setImplementation (line 79)
  • access: public
void setImplementation (string $value)
  • string $value: cache implements of TSqlMapCacheTypes, either 'Basic', 'LRU' or 'FIFO'.

Inherited Methods

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

Documentation generated on Mon, 25 Jun 2012 14:39:15 +0200 by phpDocumentor 1.4.3