mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-20 18:09:54 +00:00
62 lines
No EOL
1.7 KiB
PHP
62 lines
No EOL
1.7 KiB
PHP
<?php
|
|
/**
|
|
* CCacheDependency class file.
|
|
*
|
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
* @link http://www.yiiframework.com/
|
|
* @copyright Copyright © 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: CCacheDependency.php 433 2008-12-30 22:59:17Z qiang.xue $
|
|
* @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;
|
|
}
|
|
} |