UncacheableDependencyTrait.php 534 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Drupal\Core\Cache;
  3. /**
  4. * Trait to implement CacheableDependencyInterface for uncacheable objects.
  5. *
  6. * Use this for objects that are never cacheable.
  7. *
  8. * @see \Drupal\Core\Cache\CacheableDependencyInterface
  9. */
  10. trait UncacheableDependencyTrait {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function getCacheContexts() {
  15. return [];
  16. }
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public function getCacheTags() {
  21. return [];
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function getCacheMaxAge() {
  27. return 0;
  28. }
  29. }