ConfigCacheInterface.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Config;
  11. use Symfony\Component\Config\Resource\ResourceInterface;
  12. /**
  13. * Interface for ConfigCache.
  14. *
  15. * @author Matthias Pigulla <mp@webfactory.de>
  16. */
  17. interface ConfigCacheInterface
  18. {
  19. /**
  20. * Gets the cache file path.
  21. *
  22. * @return string The cache file path
  23. */
  24. public function getPath();
  25. /**
  26. * Checks if the cache is still fresh.
  27. *
  28. * This check should take the metadata passed to the write() method into consideration.
  29. *
  30. * @return bool Whether the cache is still fresh
  31. */
  32. public function isFresh();
  33. /**
  34. * Writes the given content into the cache file. Metadata will be stored
  35. * independently and can be used to check cache freshness at a later time.
  36. *
  37. * @param string $content The content to write into the cache
  38. * @param ResourceInterface[]|null $metadata An array of ResourceInterface instances
  39. *
  40. * @throws \RuntimeException When the cache file cannot be written
  41. */
  42. public function write(string $content, array $metadata = null);
  43. }