class DefaultCacheFactory implements CacheFactory (View source)

Returns the most performant combination of caches available on the system:

  • PhpFilesCache (PHP 7 with opcache enabled)
  • ApcuCache (requires APC) with a FilesystemCache fallback (for larger cache volumes)
  • FilesystemCache if none of the above is available

Modelled after Symfony\Component\Cache\Adapter\AbstractAdapter::createSystemCache()

Properties

protected string $args
protected LoggerInterface $logger

Methods

public
__construct(array $args = [], LoggerInterface $logger = null)

No description

public
object
create(string $service, array $args = [])

No description

protected
bool
isAPCUSupported() deprecated

Determine if apcu is supported

protected
bool
isPHPFilesSupported()

Determine if PHP files is supported

protected
CacheInterface
createCache(string $class, array $args, bool $useInjector = true)

Creates an object with a PSR-16 interface, usually from a PSR-6 class name

Details

__construct(array $args = [], LoggerInterface $logger = null)

No description

Parameters

array $args

List of global options to merge with args during create()

LoggerInterface $logger

Logger instance to assign

object create(string $service, array $args = [])

No description

Parameters

string $service

The class name of the service.

array $args

Return Value

object

The created service instances.

protected bool isAPCUSupported() deprecated

deprecated 5.4.0 Will be removed without equivalent functionality to replace it in a future major release.

Determine if apcu is supported

Return Value

bool

protected bool isPHPFilesSupported()

Determine if PHP files is supported

Return Value

bool

protected CacheInterface createCache(string $class, array $args, bool $useInjector = true)

Creates an object with a PSR-16 interface, usually from a PSR-6 class name

Quick explanation of caching standards:

  • Symfony cache implements the PSR-6 standard
  • Symfony provides adapters which wrap a PSR-6 backend with a PSR-16 interface
  • Silverstripe uses the PSR-16 interface to interact with caches. It does not directly interact with the PSR-6 classes
  • Psr\SimpleCache\CacheInterface is the php interface of the PSR-16 standard. All concrete cache classes Silverstripe code interacts with should implement this interface

Further reading:

Parameters

string $class
array $args
bool $useInjector

Return Value

CacheInterface
OSZAR »