NullPool.php 684 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Elgg\Cache;
  3. /**
  4. * Implements the caching API but doesn't actually do any caching.
  5. *
  6. * Pass an instance of this class as a cache value to turn off caching.
  7. *
  8. * WARNING: API IN FLUX. DO NOT USE DIRECTLY.
  9. *
  10. * @package Elgg
  11. * @subpackage Cache
  12. * @since 1.10.0
  13. *
  14. * @access private
  15. */
  16. final class NullPool implements Pool {
  17. /** @inheritDoc */
  18. public function get($key, callable $callback) {
  19. return call_user_func($callback);
  20. }
  21. /** @inheritDoc */
  22. public function invalidate($key) {
  23. // values are always expired, so nothing to do
  24. }
  25. /** @inheritDoc */
  26. public function put($key, $value) {
  27. // values are always expired, so nothing to do
  28. }
  29. }