NullStore.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace Illuminate\Cache;
  3. use Illuminate\Contracts\Cache\LockProvider;
  4. class NullStore extends TaggableStore implements LockProvider
  5. {
  6. use RetrievesMultipleKeys;
  7. /**
  8. * Retrieve an item from the cache by key.
  9. *
  10. * @param string $key
  11. * @return void
  12. */
  13. public function get($key)
  14. {
  15. //
  16. }
  17. /**
  18. * Store an item in the cache for a given number of seconds.
  19. *
  20. * @param string $key
  21. * @param mixed $value
  22. * @param int $seconds
  23. * @return bool
  24. */
  25. public function put($key, $value, $seconds)
  26. {
  27. return false;
  28. }
  29. /**
  30. * Increment the value of an item in the cache.
  31. *
  32. * @param string $key
  33. * @param mixed $value
  34. * @return bool
  35. */
  36. public function increment($key, $value = 1)
  37. {
  38. return false;
  39. }
  40. /**
  41. * Decrement the value of an item in the cache.
  42. *
  43. * @param string $key
  44. * @param mixed $value
  45. * @return bool
  46. */
  47. public function decrement($key, $value = 1)
  48. {
  49. return false;
  50. }
  51. /**
  52. * Store an item in the cache indefinitely.
  53. *
  54. * @param string $key
  55. * @param mixed $value
  56. * @return bool
  57. */
  58. public function forever($key, $value)
  59. {
  60. return false;
  61. }
  62. /**
  63. * Get a lock instance.
  64. *
  65. * @param string $name
  66. * @param int $seconds
  67. * @param string|null $owner
  68. * @return \Illuminate\Contracts\Cache\Lock
  69. */
  70. public function lock($name, $seconds = 0, $owner = null)
  71. {
  72. return new NoLock($name, $seconds, $owner);
  73. }
  74. /**
  75. * Restore a lock instance using the owner identifier.
  76. *
  77. * @param string $name
  78. * @param string $owner
  79. * @return \Illuminate\Contracts\Cache\Lock
  80. */
  81. public function restoreLock($name, $owner)
  82. {
  83. return $this->lock($name, 0, $owner);
  84. }
  85. /**
  86. * Remove an item from the cache.
  87. *
  88. * @param string $key
  89. * @return bool
  90. */
  91. public function forget($key)
  92. {
  93. return true;
  94. }
  95. /**
  96. * Remove all items from the cache.
  97. *
  98. * @return bool
  99. */
  100. public function flush()
  101. {
  102. return true;
  103. }
  104. /**
  105. * Get the cache key prefix.
  106. *
  107. * @return string
  108. */
  109. public function getPrefix()
  110. {
  111. return '';
  112. }
  113. }