libs/Yii/web/CCacheHttpSession.php
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* CCacheHttpSession class
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2011 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* CCacheHttpSession implements a session component using cache as storage medium.
*
* The cache being used can be any cache application component implementing {@link ICache} interface.
* The ID of the cache application component is specified via {@link cacheID}, which defaults to 'cache'.
*
* Beware, by definition cache storage are volatile, which means the data stored on them
* may be swapped out and get lost. Therefore, you must make sure the cache used by this component
* is NOT volatile. If you want to use {@link CDbCache} as storage medium, use {@link CDbHttpSession}
* is a better choice.
*
* @property boolean $useCustomStorage Whether to use custom storage.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package system.web
* @since 1.0
*/
class CCacheHttpSession extends CHttpSession
{
/**
* Prefix to the keys for storing cached data
*/
const CACHE_KEY_PREFIX='Yii.CCacheHttpSession.';
/**
* @var string the ID of the cache application component. Defaults to 'cache' (the primary cache application component.)
*/
public $cacheID='cache';
/**
* @var ICache the cache component
*/
private $_cache;
/**
* Initializes the application component.
* This method overrides the parent implementation by checking if cache is available.
*/
public function init()
{
$this->_cache=Yii::app()->getComponent($this->cacheID);
if(!($this->_cache instanceof ICache))
throw new CException(Yii::t('yii','CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers to a valid cache application component.',
array('{id}'=>$this->cacheID)));
parent::init();
}
/**
* Returns a value indicating whether to use custom session storage.
后面还有 53 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
