Cache Dependency parameters

How to set params in CExpressionDependency?

I see dependency object is stored in cache (I’m not sure it’s a good idea). So it can use global vars only. But I need to use local vars. How?

Welcome to forum.

I have created a ticket for this.

When this feature gets implemented you should be able to do:




$someVar = 1;


$dependency = new CExpressionDependency('$someVar == 1', array('someVar' => $someVar));



// For now you may use this modified class




class ExpressionDependency extends CCacheDependency

{


	public $expression;

	public $data;


	public function __construct($expression='true', $data = array())

	{

		$this->expression=$expression;

		$this->data=$data;

	}


	protected function generateDependentData()

	{

		return $this->evaluateExpression($this->expression, $this->data);

	}

	

}



Has this been fixed? It still doesn’t work… For example: new CExpressionDependency(‘rand(0,1000)’) works but you cannot pass in a local variable which is really the whole point of expression dependency.