*/ 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:----VQVONGG+l8c6+cvfjetkjDBjLusNJPYOqAXeUzW5ck0swX/YH9qwojLD+PbRC9qQ2swbqDxeQUw3jbT0Djhutn85KrEotyhAEQ0l0PtnICcvM60KfQ4UDDeIwJybtb5pcW1tkZcIDgJyOCGUcXVBw2kaJCfc0UzPlE7GoP9Lo7S1Zg6tZusRvMImO7bEDt2jm3+zI3l38SzwDi4xDtY44sKt1QoAkcaSWTF8OHVJ4mu+ZRr43FJvManFl3aGdIpbp28hUDHXF3OqdWkXPBYqWOXuysDekwHFCzqJ7YtShsz6a1uwotYVtflamjDqSbTSTt2ss++mqW47xt5UaiHlMcjxfaQ2oF9Nw1gcrlsZe4wllUJVEvPvLP19mKNHWKd3oEG5RLndcZzngVg14aQcg/sazOm0+FoBrJZ9unaSJcrAqNj+ruiN1l9RQNXQjuTlyqCphI227S+jGNCTEu5zkzhCO0SvbDT4bV7tWyQwqEgHzTP/SoiV14i5WrSnVURaam6xlZmj/VY0yIsMnY+T6gZCPLEi9SUXrF3Zaz5wz3WzNpUwh8XGWpjsJnz6Jy/5irAqXCDJbQ52iBdbWP9p+sIEAw51kRV1TGHwwVz4wuSz1KhjlBgkExWGM4lYiKGygaYk0zYVD4YMXPegeZV1/yT25YUtyevMV2kiLfar934=----ATTACHMENT:----NTUzNDczMzQxMjc5NTY5NiA4MjIyMjc5MDk2MzEzMDk4IDQ5MzA0NjI3OTkzODQ3NDc=