Store.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace Illuminate\Contracts\Cache;
  3. interface Store
  4. {
  5. /**
  6. * Retrieve an item from the cache by key.
  7. *
  8. * @param string|array $key
  9. * @return mixed
  10. */
  11. public function get($key);
  12. /**
  13. * Retrieve multiple items from the cache by key.
  14. *
  15. * Items not found in the cache will have a null value.
  16. *
  17. * @param array $keys
  18. * @return array
  19. */
  20. public function many(array $keys);
  21. /**
  22. * Store an item in the cache for a given number of seconds.
  23. *
  24. * @param string $key
  25. * @param mixed $value
  26. * @param int $seconds
  27. * @return bool
  28. */
  29. public function put($key, $value, $seconds);
  30. /**
  31. * Store multiple items in the cache for a given number of seconds.
  32. *
  33. * @param array $values
  34. * @param int $seconds
  35. * @return bool
  36. */
  37. public function putMany(array $values, $seconds);
  38. /**
  39. * Increment the value of an item in the cache.
  40. *
  41. * @param string $key
  42. * @param mixed $value
  43. * @return int|bool
  44. */
  45. public function increment($key, $value = 1);
  46. /**
  47. * Decrement the value of an item in the cache.
  48. *
  49. * @param string $key
  50. * @param mixed $value
  51. * @return int|bool
  52. */
  53. public function decrement($key, $value = 1);
  54. /**
  55. * Store an item in the cache indefinitely.
  56. *
  57. * @param string $key
  58. * @param mixed $value
  59. * @return bool
  60. */
  61. public function forever($key, $value);
  62. /**
  63. * Remove an item from the cache.
  64. *
  65. * @param string $key
  66. * @return bool
  67. */
  68. public function forget($key);
  69. /**
  70. * Remove all items from the cache.
  71. *
  72. * @return bool
  73. */
  74. public function flush();
  75. /**
  76. * Get the cache key prefix.
  77. *
  78. * @return string
  79. */
  80. public function getPrefix();
  81. }