Class TCachePageStatePersister
TCachePageStatePersister class
TCachePageStatePersister implements a page state persistent method based on cache. Page state are stored in cache (e.g. memcache, DB cache, etc.), and only a small token is passed to the client side to identify the state. This greatly reduces the size of the page state that needs to be transmitted between the server and the client. Of course, this is at the cost of using server side resource.
A cache module has to be loaded in order to use TCachePageStatePersister. By
default, TCachePageStatePersister will use the primary cache module. A
non-primary cache module can be used by setting setCacheModuleID
CacheModuleID. Any cache module, as long as it implements the interface ICache
, may be used. For example, one can use TDbCache
, TMemCache
, TAPCCache
, etc.
TCachePageStatePersister uses setCacheTimeout CacheTimeout to limit the data that stores in cache.
Since server resource is often limited, be cautious if you plan to use TCachePageStatePersister for high-traffic Web pages. You may consider using a small setCacheTimeout CacheTimeout.
There are a couple of ways to use TCachePageStatePersister. One can override
the page's TPage::getStatePersister()
method and create a
TCachePageStatePersister instance there. Or one can configure the pages to use
TCachePageStatePersister in page configurations as follows,
<pages StatePersisterClass="System.Web.UI.TCachePageStatePersister" StatePersister.CacheModuleID="mycache" StatePersister.CacheTimeout="3600" />
Note in the above, we use StatePersister.CacheModuleID to configure the cache module ID for the TCachePageStatePersister instance.
The above configuration will affect the pages under the directory containing this configuration and all its subdirectories. To configure individual pages to use TCachePageStatePersister, use
<pages> <page id="PageID" StatePersisterClass="System.Web.UI.TCachePageStatePersister" /> </pages>
- TComponent
-
TCachePageStatePersister implements IPageStatePersister
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.1.1
Located at Web/UI/TCachePageStatePersister.php
public
|
|
public
|
|
public
string
|
|
public
|
|
public
|
|
public
integer
|
|
public
|
|
public
string
|
|
public
|
|
protected
string
|
|
public
|
|
public
mixed
|
GLOBAL_RAISE_EVENT_LISTENER
|