- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

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:
IActiveControl
IBindable
ICache
ICacheDependency
ICallbackEventHandler
IDataRenderer
IModule
IRenderable
IService
IStatePersister
IStyleable
ITextWriter
IUser
Prado
PradoBase
TApplication
TApplicationComponent
TApplicationConfiguration
TApplicationMode
TApplicationStatePersister
TComponent
TComponentReflection
TDraggableConstraint
TDropContainerEventParameter
TEnumerable
TEventParameter
TModule
TPropertyValue
TReflectionClass
TService
TShellApplication

Keyword

# Interface ICache

ICache interface.

This interface must be implemented by cache managers.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
boolean | add ( string $id, mixed $value, integer $expire, ICacheDependency $dependency) Stores a value identified by a key into cache if the cache does not contain this key.
boolean | delete ( string $id) Deletes a value with the specified key from cache
void | flush () Deletes all values from cache.
mixed | get ( string $id) Retrieves a value from cache with a specified key.
boolean | set ( string $id, mixed $value, integer $expire, ICacheDependency $dependency) Stores a value identified by a key into cache.

Method Details

## add

public boolean add | (string $id , mixed $value , integer $expire , ICacheDependency $dependency )

Stores a value identified by a key into cache if the cache does not contain this key.

Nothing will be done if the cache already contains the key.

Input
string | $id | the key identifying the value to be cached
mixed | $value | the value to be cached
integer | $expire | the number of seconds in which the cached value will expire. 0 means never expire.
ICacheDependency | $dependency | dependency of the cached item. If the dependency changes, the item is labelled invalid.
Output
boolean | true if the value is successfully stored into cache, false otherwise
Exception

## delete

public boolean delete | (string $id )

Deletes a value with the specified key from cache

Input
string | $id | the key of the value to be deleted
Output
boolean | if no error happens during deletion
Exception

## flush

public void flush | ()

Deletes all values from cache.

Be careful of performing this operation if the cache is shared by multiple applications.

Output
Exception

## get

public mixed get | (string $id )

Retrieves a value from cache with a specified key.

Input
string | $id | a key identifying the cached value
Output
mixed | the value stored in cache, false if the value is not in the cache or expired.
Exception

## set

public boolean set | (string $id , mixed $value , integer $expire , ICacheDependency $dependency )

Stores a value identified by a key into cache.

If the cache already contains such a key, the existing value and expiration time will be replaced with the new ones.

Input
string | $id | the key identifying the value to be cached
mixed | $value | the value to be cached
integer | $expire | the number of seconds in which the cached value will expire. 0 means never expire.
ICacheDependency | $dependency | dependency of the cached item. If the dependency changes, the item is labelled invalid.
Output
boolean | true if the value is successfully stored into cache, false otherwise
Exception