/framework/vendor/swift/lib/classes/Swift/KeyCache.php

http://zoop.googlecode.com/ · PHP · 99 lines · 16 code · 14 blank · 69 comment · 0 complexity · 1b77a5ee8bfb7cf3ab529a34f8bf765e MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. //@require 'Swift/InputByteStream.php';
  10. //@require 'Swift/OutputByteStream.php';
  11. /**
  12. * Provides a mechanism for storing data using two keys.
  13. * @package Swift
  14. * @subpackage KeyCache
  15. * @author Chris Corbyn
  16. */
  17. interface Swift_KeyCache
  18. {
  19. /** Mode for replacing existing cached data */
  20. const MODE_WRITE = 1;
  21. /** Mode for appending data to the end of existing cached data */
  22. const MODE_APPEND = 2;
  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. * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
  34. * @param string $nsKey
  35. * @param string $itemKey
  36. * @param Swift_OutputByteStream $os
  37. * @param int $mode
  38. * @see MODE_WRITE, MODE_APPEND
  39. */
  40. public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os,
  41. $mode);
  42. /**
  43. * Provides a ByteStream which when written to, writes data to $itemKey.
  44. * NOTE: The stream will always write in append mode.
  45. * If the optional third parameter is passed all writes will go through $is.
  46. * @param string $nsKey
  47. * @param string $itemKey
  48. * @param Swift_InputByteStream $is, optional
  49. * @return Swift_InputByteStream
  50. */
  51. public function getInputByteStream($nsKey, $itemKey,
  52. Swift_InputByteStream $is = null);
  53. /**
  54. * Get data back out of the cache as a string.
  55. * @param string $nsKey
  56. * @param string $itemKey
  57. * @return string
  58. */
  59. public function getString($nsKey, $itemKey);
  60. /**
  61. * Get data back out of the cache as a ByteStream.
  62. * @param string $nsKey
  63. * @param string $itemKey
  64. * @param Swift_InputByteStream $is to write the data to
  65. */
  66. public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is);
  67. /**
  68. * Check if the given $itemKey exists in the namespace $nsKey.
  69. * @param string $nsKey
  70. * @param string $itemKey
  71. * @return boolean
  72. */
  73. public function hasKey($nsKey, $itemKey);
  74. /**
  75. * Clear data for $itemKey in the namespace $nsKey if it exists.
  76. * @param string $nsKey
  77. * @param string $itemKey
  78. */
  79. public function clearKey($nsKey, $itemKey);
  80. /**
  81. * Clear all data in the namespace $nsKey if it exists.
  82. * @param string $nsKey
  83. */
  84. public function clearAll($nsKey);
  85. }