PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/includes/patTemplate/patTemplate/TemplateCache.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 80 lines | 17 code | 3 blank | 60 comment | 0 complexity | 5f62b6ffc0b9e9c5b3f27ba513677c8a MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?PHP
  2. /**
  3. * Base class for patTemplate template cache
  4. *
  5. * $Id: TemplateCache.php 47 2005-09-15 02:55:27Z rhuk $
  6. *
  7. * A template cache is used to cache the data after
  8. * the template has been read, but before the variables
  9. * have been added.
  10. *
  11. * Data is normally stored in serialized format. This
  12. * will increase performance.
  13. *
  14. * This is not related to an output cache!
  15. *
  16. * @package patTemplate
  17. * @subpackage Caches
  18. * @author Stephan Schmidt <schst@php.net>
  19. */
  20. /**
  21. * Base class for patTemplate template cache
  22. *
  23. * $Id: TemplateCache.php 47 2005-09-15 02:55:27Z rhuk $
  24. *
  25. * A template cache is used to cache the data after
  26. * the template has been read, but before the variables
  27. * have been added.
  28. *
  29. * Data is normally stored in serialized format. This
  30. * will increase performance.
  31. *
  32. * This is not related to an output cache!
  33. *
  34. * @abstract
  35. * @package patTemplate
  36. * @subpackage Caches
  37. * @author Stephan Schmidt <schst@php.net>
  38. */
  39. class patTemplate_TemplateCache extends patTemplate_Module
  40. {
  41. /**
  42. * load template from cache
  43. *
  44. * @access public
  45. * @param string cache key
  46. * @param integer modification time of original template
  47. * @return array|boolean either an array containing the templates or false cache could not be loaded
  48. */
  49. function load( $key, $modTime = -1 )
  50. {
  51. return false;
  52. }
  53. /**
  54. * write template to cache
  55. *
  56. * @access public
  57. * @param string cache key
  58. * @param array templates to store
  59. */
  60. function write( $key, $templates )
  61. {
  62. return true;
  63. }
  64. /**
  65. * get the cache key for the input
  66. *
  67. * @param mixed input to read from.
  68. * This can be a string, a filename, a resource or whatever the derived class needs to read from
  69. * @param array options
  70. * @return string key
  71. */
  72. function getKey( $input, $options = array() )
  73. {
  74. return md5( $input . serialize( $options ) );
  75. }
  76. }
  77. ?>