PHP 클래스 Prado\Web\UI\TCachePageStatePersister

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 {@link setCacheModuleID CacheModuleID}. Any cache module, as long as it implements the interface {@link ICache}, may be used. For example, one can use {@link TDbCache}, {@link TMemCache}, {@link TAPCCache}, etc. TCachePageStatePersister uses {@link 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 {@link setCacheTimeout CacheTimeout}. There are a couple of ways to use TCachePageStatePersister. One can override the page's {@link TPage::getStatePersister()} method and create a TCachePageStatePersister instance there. Or one can configure the pages to use TCachePageStatePersister in page configurations as follows, 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
부터: 3.1.1
저자: Qiang Xue ([email protected])
상속: extends Prado\TComponent, implements Prado\Web\UI\IPageStatePersister
파일 보기 프로젝트 열기: pradosoft/prado

공개 메소드들

메소드 설명
getCache ( ) : Prado\Caching\ICache
getCacheModuleID ( ) : string
getCacheTimeout ( ) : integer
getKeyPrefix ( ) : string
getPage ( )
load ( ) : mixed Loads page state from cache.
save ( $data ) Saves state in cache.
setCacheModuleID ( $value )
setCacheTimeout ( $value )
setKeyPrefix ( $value )
setPage ( TPage $page )

보호된 메소드들

메소드 설명
calculateKey ( $timestamp ) : string

메소드 상세

calculateKey() 보호된 메소드

protected calculateKey ( $timestamp ) : string
리턴 string a key that is unique per user request

getCache() 공개 메소드

public getCache ( ) : Prado\Caching\ICache
리턴 Prado\Caching\ICache the cache module being used for data storage

getCacheModuleID() 공개 메소드

public getCacheModuleID ( ) : string
리턴 string the ID of the cache module.

getCacheTimeout() 공개 메소드

public getCacheTimeout ( ) : integer
리턴 integer the number of seconds in which the cached state will expire. Defaults to 1800.

getKeyPrefix() 공개 메소드

public getKeyPrefix ( ) : string
리턴 string prefix of cache variable name to avoid conflict with other cache data. Defaults to 'statepersister'.

getPage() 공개 메소드

public getPage ( )

load() 공개 메소드

Loads page state from cache.
public load ( ) : mixed
리턴 mixed the restored state

save() 공개 메소드

Saves state in cache.
public save ( $data )

setCacheModuleID() 공개 메소드

public setCacheModuleID ( $value )

setCacheTimeout() 공개 메소드

public setCacheTimeout ( $value )

setKeyPrefix() 공개 메소드

public setKeyPrefix ( $value )

setPage() 공개 메소드

public setPage ( TPage $page )
$page TPage