final class DoctrineCache in Plug 7
Adapts a Doctrine cache to a CacheInterface.
@author Florian Voutzinos <florian@voutzinos.com>
Hierarchy
- class \Symfony\Component\Validator\Mapping\Cache\DoctrineCache implements CacheInterface
Expanded class hierarchy of DoctrineCache
1 file declares its use of DoctrineCache
- DoctrineCacheTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Mapping/ Cache/ DoctrineCacheTest.php
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Cache/ DoctrineCache.php, line 22
Namespace
Symfony\Component\Validator\Mapping\CacheView source
final class DoctrineCache implements CacheInterface {
private $cache;
/**
* Creates a new Doctrine cache.
*
* @param Cache $cache The cache to adapt
*/
public function __construct(Cache $cache) {
$this->cache = $cache;
}
/**
* Sets the cache to adapt.
*
* @param Cache $cache The cache to adapt
*/
public function setCache(Cache $cache) {
$this->cache = $cache;
}
/**
* {@inheritdoc}
*/
public function has($class) {
return $this->cache
->contains($class);
}
/**
* {@inheritdoc}
*/
public function read($class) {
return $this->cache
->fetch($class);
}
/**
* {@inheritdoc}
*/
public function write(ClassMetadata $metadata) {
$this->cache
->save($metadata
->getClassName(), $metadata);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DoctrineCache:: |
private | property | ||
DoctrineCache:: |
public | function |
Returns whether metadata for the given class exists in the cache. Overrides CacheInterface:: |
|
DoctrineCache:: |
public | function |
Returns the metadata for the given class from the cache. Overrides CacheInterface:: |
|
DoctrineCache:: |
public | function | Sets the cache to adapt. | |
DoctrineCache:: |
public | function |
Stores a class metadata in the cache. Overrides CacheInterface:: |
|
DoctrineCache:: |
public | function | Creates a new Doctrine cache. |