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