## 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 1555 2006-12-04 00:02:23Z wei $
- 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)
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 setID (string $value)
void setImplementation (string $value)
Methods
flush (line 113)

Clears the cache.

- access: public

void flush ()
get (line 122)

- return: cached value.
- access: public

mixed get (TSqlMapCacheKey|string $key)

- TSqlMapCacheKey|string $key: cache key

getHitRatio (line 151)

- return: cache hit ratio.
- access: public

float getHitRatio ()
getID (line 47)

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

string getID ()
getImplementation (line 63)

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

string getImplementation ()
getImplementationClass (line 91)

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

string getImplementationClass ()
initialize (line 80)

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

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

- access: public

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

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

setID (line 55)

- access: public

void setID (string $value)

- string $value: unique cache model identifier.

setImplementation (line 71)

- 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, 21 Apr 2008 11:36:16 -0400 by phpDocumentor 1.3.0RC4