1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004, 2011 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: */
11:
12: namespace Nette\Templates;
13:
14: use Nette;
15:
16:
17:
18: /**
19: * Template cache storage.
20: *
21: * @author David Grudl
22: */
23: class TemplateCacheStorage extends Nette\Caching\FileStorage
24: {
25: /** @var string */
26: public $hint;
27:
28:
29: /**
30: * Reads cache data from disk.
31: * @param array
32: * @return mixed
33: */
34: protected function readData($meta)
35: {
36: return array(
37: 'file' => $meta[self::FILE],
38: 'handle' => $meta[self::HANDLE],
39: );
40: }
41:
42:
43:
44: /**
45: * Returns file name.
46: * @param string
47: * @return string
48: */
49: protected function getCacheFile($key)
50: {
51: $key = substr_replace($key, trim(strtr($this->hint, '\\/@', '.._'), '.') . '-', strpos($key, Nette\Caching\Cache::NAMESPACE_SEPARATOR) + 1, 0);
52: return parent::getCacheFile($key) . '.php';
53: }
54:
55: }
56: