Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TSqlMapCacheModel

TComponent
   |
   --TSqlMapCacheModel

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
Author: Wei Zhuo <weizho[at]gmail[dot]com>

Method Summary
void
flush ()
Clears the cache.
mixed
get ( TSqlMapCacheKey|string $key)
integer
float
string
getID ()
string
string
void
initialize ( ISqLMapCache $cache)
Initialize the cache implementation, sets the actual cache contain if supplied.
void
Register a mapped statement that will trigger a cache flush.
void
set ( TSqlMapCacheKey|string $key, mixed $value)
void
setFlushInterval ( integer $value)
void
setID ( string $value)
void
setImplementation ( string $value)
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()

Method Details

flush

public void flush ()

Clears the cache.

Output
Exception

get

public mixed get (TSqlMapCacheKey|string $key )

Input
TSqlMapCacheKey|string$keycache key
Output
mixed cached value.
Exception

getFlushInterval

public integer getFlushInterval ()

Output
integer cache duration.
Exception

getHitRatio

public float getHitRatio ()

Output
float cache hit ratio.
Exception

getID

public string getID ()

Output
string unique cache model identifier.
Exception

getImplementation

public string getImplementation ()

Output
string cache implements of TSqlMapCacheTypes, either 'Basic', 'LRU' or 'FIFO'.
Exception

getImplementationClass

public string getImplementationClass ()

Output
string cache implementation class name.
Exception

initialize

public void initialize (ISqLMapCache $cache )

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

Input
ISqLMapCache$cachecache implementation instance.
Output
Exception

registerTriggerStatement

public void registerTriggerStatement (TMappedStatement $mappedStatement )

Register a mapped statement that will trigger a cache flush.

Input
TMappedStatement$mappedStatementmapped statement that may flush the cache.
Output
Exception

set

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

Input
TSqlMapCacheKey|string$keycache key
mixed$valuevalue to be cached.
Output
Exception

setFlushInterval

public void setFlushInterval (integer $value )

Input
integer$valuethe number of seconds in which the cached value will expire. 0 means never expire.
Output
Exception

setID

public void setID (string $value )

Input
string$valueunique cache model identifier.
Output
Exception

setImplementation

public void setImplementation (string $value )

Input
string$valuecache implements of TSqlMapCacheTypes, either 'Basic', 'LRU' or 'FIFO'.
Output
Exception