public static createCache ( string $namespace, integer $defaultLifetime, string $version, Psr\Log\LoggerInterface $logger = null ) : Symfony\Component\Cache\Adapter\AdapterInterface | ||
$namespace | string | |
$defaultLifetime | integer | |
$version | string | |
$logger | Psr\Log\LoggerInterface | |
return | Symfony\Component\Cache\Adapter\AdapterInterface |
public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null)
{
if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
throw new \RuntimeException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
}
if (!ApcuAdapter::isSupported()) {
return new NullAdapter();
}
$apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version);
if (null !== $logger) {
$apcu->setLogger($logger);
}
return $apcu;
}
/** * Gets the 'property_accessor' service. * * This service is shared. * This method always returns the same instance of the service. * * @return \Symfony\Component\PropertyAccess\PropertyAccessor A Symfony\Component\PropertyAccess\PropertyAccessor instance */ protected function getPropertyAccessorService() { return $this->services['property_accessor'] = new \Symfony\Component\PropertyAccess\PropertyAccessor(false, false, \Symfony\Component\PropertyAccess\PropertyAccessor::createCache('lZoWmNUExf', NULL, 'kYH8hP4PfdP8SU3P7jSqTZ', $this->get('monolog.logger.cache', ContainerInterface::NULL_ON_INVALID_REFERENCE))); }