BackendInterface.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * Real cache backend primitives. This functions will be used by the
  4. * Redis_Cache wrapper class that implements the high-level logic that
  5. * allows us to be Drupal compatible.
  6. */
  7. interface Redis_Cache_BackendInterface extends Redis_BackendInterface
  8. {
  9. /**
  10. * Defaut constructor
  11. *
  12. * @param string $namespace
  13. */
  14. public function __construct($client, $namespace);
  15. /**
  16. * Get namespace
  17. *
  18. * @return string
  19. */
  20. public function getNamespace();
  21. /**
  22. * Set last flush time
  23. *
  24. * @param int $time
  25. * @param boolean $volatile
  26. */
  27. public function setLastFlushTimeFor($time, $volatile = false);
  28. /**
  29. * Get last flush time
  30. *
  31. * @return int[]
  32. * First value is for non-volatile items, second value is for volatile items.
  33. */
  34. public function getLastFlushTime();
  35. /**
  36. * Get a single entry
  37. *
  38. * @param string $id
  39. *
  40. * @return stdClass
  41. * Cache entry or false if the entry does not exists.
  42. */
  43. public function get($id);
  44. /**
  45. * Get multiple entries
  46. *
  47. * @param string[] $idList
  48. *
  49. * @return stdClass[]
  50. * Existing cache entries keyed by id,
  51. */
  52. public function getMultiple(array $idList);
  53. /**
  54. * Set a single entry
  55. *
  56. * @param string $id
  57. * @param mixed $data
  58. * @param int $ttl
  59. * @param boolean $volatile
  60. */
  61. public function set($id, $data, $ttl = null, $volatile = false);
  62. /**
  63. * Delete a single entry
  64. *
  65. * @param string $cid
  66. */
  67. public function delete($id);
  68. /**
  69. * Delete multiple entries
  70. *
  71. * This method should not use a single DEL command but use a pipeline instead
  72. *
  73. * @param array $idList
  74. */
  75. public function deleteMultiple(array $idList);
  76. /**
  77. * Delete entries by prefix
  78. *
  79. * @param string $prefix
  80. */
  81. public function deleteByPrefix($prefix);
  82. /**
  83. * Flush all entries
  84. */
  85. public function flush();
  86. /**
  87. * Flush all entries marked as temporary
  88. */
  89. public function flushVolatile();
  90. }