CacheKey.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Model\Layout;
  7. /**
  8. * Layout cache key model
  9. */
  10. class CacheKey implements \Magento\Framework\View\Layout\LayoutCacheKeyInterface
  11. {
  12. /**
  13. * Cache keys to be able to generate different cache id for same handles
  14. *
  15. * @var array
  16. */
  17. private $cacheKeys = [];
  18. /**
  19. * Add cache key(s) for generating different cache id for same handles
  20. *
  21. * @param array|string $cacheKeys
  22. * @return void
  23. */
  24. public function addCacheKeys($cacheKeys)
  25. {
  26. if (!is_array($cacheKeys)) {
  27. $cacheKeys = [$cacheKeys];
  28. }
  29. $this->cacheKeys = array_merge($this->cacheKeys, $cacheKeys);
  30. }
  31. /**
  32. * Return cache keys array
  33. *
  34. * @return array
  35. */
  36. public function getCacheKeys()
  37. {
  38. return $this->cacheKeys;
  39. }
  40. }