Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

62 lines (57 sloc) 1.65 kb
<?php
/**
* CCacheDependency class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright &copy; 2008-2009 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* CCacheDependency is the base class for cache dependency classes.
*
* CCacheDependency implements the {@link ICacheDependency} interface.
* Child classes should override its {@link generateDependentData} for
* actual dependency checking.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package system.caching.dependencies
* @since 1.0
*/
class CCacheDependency extends CComponent implements ICacheDependency
{
private $_data;
/**
* Evaluates the dependency by generating and saving the data related with dependency.
* This method is invoked by cache before writing data into it.
*/
public function evaluateDependency()
{
$this->_data=$this->generateDependentData();
}
/**
* @return boolean whether the dependency has changed.
*/
public function getHasChanged()
{
return $this->generateDependentData()!=$this->_data;
}
/**
* @return mixed the data used to determine if dependency has been changed.
* This data is available after {@link evaluateDependency} is called.
*/
public function getDependentData()
{
return $this->_data;
}
/**
* Generates the data needed to determine if dependency has been changed.
* Derived classes should override this method to generate actual dependent data.
* @return mixed the data needed to determine if dependency has been changed.
*/
protected function generateDependentData()
{
return null;
}
}
Jump to Line
Something went wrong with that request. Please try again.