NullEngine.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Cache\Engine;
  16. use Cake\Cache\CacheEngine;
  17. /**
  18. * Null cache engine, all operations appear to work, but do nothing.
  19. *
  20. * This is used internally for when Cache::disable() has been called.
  21. */
  22. class NullEngine extends CacheEngine
  23. {
  24. /**
  25. * {@inheritDoc}
  26. */
  27. public function init(array $config = [])
  28. {
  29. return true;
  30. }
  31. /**
  32. * {@inheritDoc}
  33. */
  34. public function gc($expires = null)
  35. {
  36. }
  37. /**
  38. * {@inheritDoc}
  39. */
  40. public function write($key, $value)
  41. {
  42. return true;
  43. }
  44. /**
  45. * {@inheritDoc}
  46. */
  47. public function read($key)
  48. {
  49. return false;
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public function readMany($keys)
  55. {
  56. return [];
  57. }
  58. /**
  59. * {@inheritDoc}
  60. */
  61. public function increment($key, $offset = 1)
  62. {
  63. return true;
  64. }
  65. /**
  66. * {@inheritDoc}
  67. */
  68. public function decrement($key, $offset = 1)
  69. {
  70. return true;
  71. }
  72. /**
  73. * {@inheritDoc}
  74. */
  75. public function delete($key)
  76. {
  77. return true;
  78. }
  79. /**
  80. * {@inheritDoc}
  81. */
  82. public function deleteMany($keys)
  83. {
  84. return [];
  85. }
  86. /**
  87. * {@inheritDoc}
  88. */
  89. public function clear($check)
  90. {
  91. return false;
  92. }
  93. /**
  94. * {@inheritDoc}
  95. */
  96. public function clearGroup($group)
  97. {
  98. return false;
  99. }
  100. }