Source for file TemplateCacheStorage.php

Documentation is available at TemplateCacheStorage.php

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework
  5. 5:  *
  6. 6:  * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  7. 7:  *
  8. 8:  * This source file is subject to the "Nette license" that is bundled
  9. 9:  * with this package in the file license.txt.
  10. 10:  *
  11. 11:  * For more information please see https://nette.org
  12. 12:  *
  13. 13:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  14. 14:  * @license    https://nette.org/license  Nette license
  15. 15:  * @link       https://nette.org
  16. 16:  * @category   Nette
  17. 17:  * @package    Nette\Templates
  18. 18:  * @version    $Id$
  19. 19:  */
  20. 20:  
  21. 21:  
  22. 22:  
  23. 23: require_once dirname(__FILE__'/../Caching/FileStorage.php';
  24. 24:  
  25. 25:  
  26. 26:  
  27. 27: /**
  28. 28:  * Template cache storage.
  29. 29:  *
  30. 30:  * @author     David Grudl
  31. 31:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  32. 32:  * @package    Nette\Templates
  33. 33:  */
  34. 35: {
  35. 36:  
  36. 37:     /**
  37. 38:      * Reads cache data from disk.
  38. 39:      * @param  array 
  39. 40:      * @return mixed 
  40. 41:      */
  41. 42:     protected function readData($meta)
  42. 43:     {
  43. 44:         return array(
  44. 45:             'file' => $meta[self::FILE],
  45. 46:             'handle' => $meta[self::HANDLE],
  46. 47:         );
  47. 48:     }
  48. 49:  
  49. 50:  
  50. 51:  
  51. 52:     /**
  52. 53:      * Returns file name.
  53. 54:      * @param  string 
  54. 55:      * @return string 
  55. 56:      */
  56. 57:     protected function getCacheFile($key)
  57. 58:     {
  58. 59:         $path $this->base . urlencode($key);
  59. 60:         if (substr($path-6!== '.php'$path .= '.php';
  60. 61:         return $path;
  61. 62:     }
  62. 63:  
  63. 64: }