## 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.

- since: 3.1
- version: $Id: TSqlMapCacheModel.php 2757 2010-01-15 14:47:40Z Christophe.Boulain $
- author: Wei Zhuo <weizho[at]gmail[dot]com>

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

    TComponent
       |
       --TSqlMapCacheModel

Method Summary
void flush ()
mixed get (TSqlMapCacheKey|string $key)
integer getFlushInterval ()
float getHitRatio ()
string getID ()
string getImplementation ()
string getImplementationClass ()
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
flush (line 130)

Clears the cache.

- access: public

void flush ()
get (line 139)

- return: cached value.
- access: public

mixed get (TSqlMapCacheKey|string $key)

- TSqlMapCacheKey|string $key: cache key

getFlushInterval (line 88)

- return: cache duration.
- access: public

integer getFlushInterval ()
getHitRatio (line 168)

- return: cache hit ratio.
- access: public

float getHitRatio ()
getID (line 48)

- return: unique cache model identifier.
- access: public

string getID ()
getImplementation (line 64)

- return: cache implements of TSqlMapCacheTypes, either 'Basic', 'LRU' or 'FIFO'.
- access: public

string getImplementation ()
getImplementationClass (line 108)

- return: cache implementation class name.
- access: public

string getImplementationClass ()
initialize (line 97)

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 122)

Register a mapped statement that will trigger a cache flush.

- access: public

void registerTriggerStatement (TMappedStatement $mappedStatement)

- TMappedStatement $mappedStatement: mapped statement that may flush the cache.

set (line 156)

- access: public

void set (TSqlMapCacheKey|string $key, mixed $value)

- TSqlMapCacheKey|string $key: cache key
- mixed $value: value to be cached.

setFlushInterval (line 80)

- 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 56)

- access: public

void setID (string $value)

- string $value: unique cache model identifier.

setImplementation (line 72)

- 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::__get()
> TComponent::__set()

Documentation generated on Mon, 22 Feb 2010 12:18:41 +0000 by phpDocumentor 1.3.0RC4