[Cache] add constructor docblocks for clarity

This commit is contained in:
Christian Flothmann 2017-07-14 14:26:39 +02:00
parent 6304938548
commit 813a5377e1
6 changed files with 43 additions and 1 deletions

View File

@ -39,6 +39,10 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
*/
protected $maxIdLength;
/**
* @param string $namespace
* @param int $defaultLifetime
*/
protected function __construct($namespace = '', $defaultLifetime = 0)
{
$this->namespace = '' === $namespace ? '' : $this->getId($namespace).':';
@ -81,6 +85,15 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
);
}
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string $version
* @param string $directory
* @param LoggerInterface|null $logger
*
* @return AdapterInterface
*/
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
{
if (null === self::$apcuSupported) {
@ -139,7 +152,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
/**
* Deletes all items in the pool.
*
* @param string The prefix used for all identifiers managed by this pool
* @param string $namespace The prefix used for all identifiers managed by this pool
*
* @return bool True if the pool was successfully cleared, false otherwise
*/

View File

@ -24,6 +24,13 @@ class ApcuAdapter extends AbstractAdapter
return function_exists('apcu_fetch') && ini_get('apc.enabled');
}
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string|null $version
*
* @throws CacheException if APCu is not enabled
*/
public function __construct($namespace = '', $defaultLifetime = 0, $version = null)
{
if (!static::isSupported()) {

View File

@ -20,6 +20,11 @@ class DoctrineAdapter extends AbstractAdapter
{
private $provider;
/**
* @param CacheProvider $provider
* @param string $namespace
* @param int $defaultLifetime
*/
public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0)
{
parent::__construct('', $defaultLifetime);

View File

@ -20,6 +20,11 @@ class FilesystemAdapter extends AbstractAdapter
{
use FilesystemAdapterTrait;
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string|null $directory
*/
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{
parent::__construct('', $defaultLifetime);

View File

@ -29,6 +29,13 @@ class PhpFilesAdapter extends AbstractAdapter
return function_exists('opcache_invalidate') && ini_get('opcache.enable');
}
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string|null $directory
*
* @throws CacheException if OPcache is not enabled
*/
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{
if (!static::isSupported()) {

View File

@ -26,6 +26,11 @@ class ProxyAdapter implements AdapterInterface
private $createCacheItem;
private $poolHash;
/**
* @param CacheItemPoolInterface $pool
* @param string $namespace
* @param int $defaultLifetime
*/
public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defaultLifetime = 0)
{
$this->pool = $pool;