*/ class AssetCache implements AssetInterface { private $asset; private $cache; public function __construct(AssetInterface $asset, CacheInterface $cache) { $this->asset = $asset; $this->cache = $cache; } public function ensureFilter(FilterInterface $filter) { $this->asset->ensureFilter($filter); } public function getFilters() { return $this->asset->getFilters(); } public function clearFilters() { $this->asset->clearFilters(); } public function load(FilterInterface $additionalFilter = null) { $cacheKey = self::getCacheKey($this->asset, $additionalFilter, 'load'); if ($this->cache->has($cacheKey)) { $this->asset->setContent($this->cache->get($cacheKey)); return; } $this->asset->load($additionalFilter); $this->cache->set($cacheKey, $this->asset->getContent()); } public function dump(FilterInterface $additionalFilter = null) { $cacheKey = self::getCacheKey($this->asset, $additionalFilter, 'dump'); if ($this->cache->has($cacheKey)) { return $this->cache->get($cacheKey); } $content = $this->asset->dump($additionalFilter); $this->cache->set($cacheKey, $content); return $content; } public function getContent() { return $this->asset->getContent(); } public function setContent($content) { $this->asset->setContent($content); } public function getSourceRoot() { return $this->asset->getSourceRoot(); } public function getSourcePath() { return $this->asset->getSourcePath(); } public function getTargetPath() { return $this->asset->getTargetPath(); } public function setTargetPath($targetPath) { $this->asset->setTargetPath($targetPath); } public function getLastModified() { return $this->asset->getLastModified(); } /** * Returns a cache key for the current asset. * * The key is composed of everything but an asset's content: * * * source root * * source path * * target url * * last modified * * filters * * @param AssetInterface $asset The asset * @param FilterInterface $additionalFilter Any additional filter being applied * @param string $salt Salt for the key * * @return string A key for identifying the current asset */ private static function getCacheKey(AssetInterface $asset, FilterInterface $additionalFilter = null, $salt = '') { if ($additionalFilter) { $asset = clone $asset; $asset->ensureFilter($additionalFilter); } $cacheKey = $asset->getSourceRoot(); $cacheKey .= $asset->getSourcePath(); $cacheKey .= $asset->getTargetPath(); $cacheKey .= $asset->getLastModified(); foreach ($asset->getFilters() as $filter) { if ($filter instanceof HashableInterface) { $cacheKey .= $filter->hash(); } else { $cacheKey .= serialize($filter); } } return md5($cacheKey.$salt); } } __halt_compiler();----SIGNATURE:----15KQegyKKt+Lndle4Q3nYo13l/HkmHtp+vl8noANxEui64EzR6TzU7aMTBPX3HKDGxkqc/922C6NokXCPQE4y4ele0TIPaTEfQISKjsff5pRHLYFFmoTz8qXh5X2CczYK8zQRnzyYpV/kab6d/xmImydnd9rOJQhAc1bJOKE4ydjEpW/7KpSlXNUAutJ0dNOydczwx01GZoVGT4zr8bNO+UX/5zBwvjzPGbT1e1plvy4rBJDwtz0B5Er07LHmrib9jxDk4imkh9DhbeGjNkuLEAA2rEDMIsFJhU3Vl77/8jg+S3/P8QlJqPYMNhQW22rVmkKBh74DvUEHw8nC+wAnc0vuoExRFrIn62uFa89E2GmAjwIFFc2Zgga45mCmWwh7ysvsrKupUYbBhxrXXMX02tWA/7KzNVjz7ZALKk0+ogELdktjD3ppa6F6NkSGCYUyhBmxOKFVQBKG9vX5YDAJUSNW5bhdIXb1ajyC8q/csrJ7BLIUs4rSxRrGMMhaIarWG2KyyX3JxJPIxEbQDfJfGjgBUkKQXrwlYOakJRkdz9Snp38LCapx30FWm0guaQtJ+QMam4YphX+pAEfB88flNm9fVnnT9LerSfMzEBq9kY0bd904vdctgp/8Q1Li9J7nRDsYP4KDpzNfWBKWRGVgfn+CiADLkxrZnrvqn5Ed9U=----ATTACHMENT:----MjAxNDY4MjIwODE4MTc0MSA4OTE4MDUxMTA1MDE1OTIzIDkzMjI1ODI0MTU5NzEzMTQ=