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