DummyKeyCache.php 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /*
  3. A dummy KeyCache used to exclude cache layer from problems
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. /**
  16. * A basic KeyCache backed by an array.
  17. * @package Swift
  18. * @subpackage KeyCache
  19. * @author Xavier De Cock <xdecock@gmail.com>
  20. */
  21. class Swift_KeyCache_DummyKeyCache implements Swift_KeyCache
  22. {
  23. /**
  24. * Set a string into the cache under $itemKey for the namespace $nsKey.
  25. * @param string $nsKey
  26. * @param string $itemKey
  27. * @param string $string
  28. * @param int $mode
  29. * @see MODE_WRITE, MODE_APPEND
  30. */
  31. public function setString($nsKey, $itemKey, $string, $mode)
  32. {}
  33. /**
  34. * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
  35. * @param string $nsKey
  36. * @param string $itemKey
  37. * @param Swift_OutputByteStream $os
  38. * @param int $mode
  39. * @see MODE_WRITE, MODE_APPEND
  40. */
  41. public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os,
  42. $mode)
  43. {}
  44. /**
  45. * Provides a ByteStream which when written to, writes data to $itemKey.
  46. * NOTE: The stream will always write in append mode.
  47. * @param string $nsKey
  48. * @param string $itemKey
  49. * @return Swift_InputByteStream
  50. */
  51. public function getInputByteStream($nsKey, $itemKey,
  52. Swift_InputByteStream $writeThrough = null)
  53. {
  54. return false;
  55. }
  56. /**
  57. * Get data back out of the cache as a string.
  58. * @param string $nsKey
  59. * @param string $itemKey
  60. * @return string
  61. */
  62. public function getString($nsKey, $itemKey)
  63. {
  64. return false;
  65. }
  66. /**
  67. * Get data back out of the cache as a ByteStream.
  68. * @param string $nsKey
  69. * @param string $itemKey
  70. * @param Swift_InputByteStream $is to write the data to
  71. */
  72. public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
  73. {
  74. return false;
  75. }
  76. /**
  77. * Check if the given $itemKey exists in the namespace $nsKey.
  78. * @param string $nsKey
  79. * @param string $itemKey
  80. * @return boolean
  81. */
  82. public function hasKey($nsKey, $itemKey)
  83. {
  84. return false;
  85. }
  86. /**
  87. * Clear data for $itemKey in the namespace $nsKey if it exists.
  88. * @param string $nsKey
  89. * @param string $itemKey
  90. */
  91. public function clearKey($nsKey, $itemKey)
  92. {}
  93. /**
  94. * Clear all data in the namespace $nsKey if it exists.
  95. * @param string $nsKey
  96. */
  97. public function clearAll($nsKey)
  98. {}
  99. }