Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • BaseDocsMassAction
  • CApplication
  • CApplicationComponent
  • CBehavior
  • CComponent
  • CEnumerable
  • CErrorEvent
  • CErrorHandler
  • CEvent
  • CExceptionEvent
  • CModel
  • CModelBehavior
  • CModelEvent
  • CModule
  • CommonFieldsBehavior
  • CSecurityManager
  • CStatePersister
  • Expression
  • MassAction
  • MassAddToList
  • MassCompleteAction
  • MassMoveFileSysObjToFolder
  • MassRemoveFromList
  • MassRenameFileSysObj
  • MassUncompleteAction
  • MobileRecentItems
  • ModulePanelItem
  • NewListFromSelection
  • PanelItem
  • QuickCRUDBehavior
  • RecentItemPanelItem
  • ServiceRoutingBehavior
  • SettingsPanelItem
  • X2AddressBehavior
  • X2AuthCache
  • X2BaseListViewBehavior

Interfaces

  • IAction
  • IApplicationComponent
  • IAuthManager
  • IBehavior
  • IFilter
  • IStatePersister
  • IUserIdentity
  • IViewRenderer
  • IWebServiceProvider
  • IWebUser

Exceptions

  • CException
  • CHttpException
  • TwitterFeedWidgetException
  • Overview
  • Package
  • Class
  • Tree

Class CStatePersister

CStatePersister implements a file-based persistent data storage.

It can be used to keep data available through multiple requests and sessions.

By default, CStatePersister stores data in a file named 'state.bin' that is located under the application CApplication::getRuntimePath runtime path. You may change the location by setting the CStatePersister::$stateFile property.

To retrieve the data from CStatePersister, call CStatePersister::load(). To save the data, call CStatePersister::save().

Comparison among state persister, session and cache is as follows:
  • session: data persisting within a single user session.
  • state persister: data persisting through all requests/sessions (e.g. hit counter).
  • cache: volatile and fast storage. It may be used as storage medium for session or state persister.

Since server resource is often limited, be cautious if you plan to use CStatePersister to store large amount of data. You should also consider using database-based persister to improve the throughput.

CStatePersister is a core application component used to store global application state. It may be accessed via CApplication::getStatePersister(). page state persistent method based on cache.

CComponent
Extended by CApplicationComponent implements IApplicationComponent
Extended by CStatePersister implements IStatePersister
Package: system\base
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/base/CStatePersister.php
Methods summary
public
# init( )

Initializes the component. This method overrides the parent implementation by making sure CStatePersister::$stateFile contains valid value.

Initializes the component. This method overrides the parent implementation by making sure CStatePersister::$stateFile contains valid value.

Overrides

CApplicationComponent::init()
public mixed
# load( )

Loads state data from persistent storage.

Loads state data from persistent storage.

Returns

mixed
state data. Null if no state data available.

Implementation of

IStatePersister::load()
public
# save( mixed $state )

Saves application state in persistent storage.

Saves application state in persistent storage.

Parameters

$state
mixed
$state state data (must be serializable).

Implementation of

IStatePersister::save()
Methods inherited from CApplicationComponent
getIsInitialized()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $stateFile
#

the file path storing the state data. Make sure the directory containing the file exists and is writable by the Web server process. If using relative path, also make sure the path is correct.

the file path storing the state data. Make sure the directory containing the file exists and is writable by the Web server process. If using relative path, also make sure the path is correct.

public string $cacheID 'cache'
#

the ID of the cache application component that is used to cache the state values. Defaults to 'cache' which refers to the primary cache application component. Set this property to false if you want to disable caching state values.

the ID of the cache application component that is used to cache the state values. Defaults to 'cache' which refers to the primary cache application component. Set this property to false if you want to disable caching state values.

Properties inherited from CApplicationComponent
$behaviors
Magic properties inherited from CApplicationComponent
$isInitialized
API documentation generated by ApiGen 2.8.0