for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yiisoft\Cache\Dependency;
use Yiisoft\Cache\CacheInterface;
/**
* CallbackDependency represents a dependency based on the result of a callback.
*
* The dependency is reported as unchanged if and only if the result of the callback is
* the same as the one evaluated when storing the data to cache.
* For more details and usage information on Cache, see the [guide article on caching](guide:caching-overview).
*/
class CallbackDependency extends Dependency
{
private $callback;
public function __construct(callable $callback)
$this->callback = $callback;
}
protected function generateDependencyData(CacheInterface $cache)
$callback = $this->callback;
return $callback();