W3cubDocs

/Symfony 3.0

Symfony\Component\Config\ConfigCache

class ConfigCache extends ResourceCheckerConfigCache

ConfigCache caches arbitrary content in files on disk.

When in debug mode, those metadata resources that implement \Symfony\Component\Config\Resource\SelfCheckingResourceInterface will be used to check cache freshness.

Methods

__construct(string $file, bool $debug)
string getPath()

Gets the cache file path.

from ResourceCheckerConfigCache
bool isFresh()

Checks if the cache is still fresh.

write(string $content, array $metadata = null)

Writes the given content into the cache file.

from ResourceCheckerConfigCache

Details

public __construct(string $file, bool $debug)

Parameters

string $file The absolute cache path
bool $debug Whether debugging is enabled or not

public string getPath()

Gets the cache file path.

Return Value

string The cache file path

public bool isFresh()

Checks if the cache is still fresh.

This implementation always returns true when debug is off and the cache file exists.

Return Value

bool true if the cache is fresh, false otherwise

public write(string $content, array $metadata = null)

Writes the given content into the cache file.

Metadata will be stored independently and can be used to check cache freshness at a later time.

Parameters

string $content The content to write in the cache
array $metadata An array of metadata

Exceptions

RuntimeException When the cache file cannot be written

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Config/ConfigCache.html