DefaultCacheFactory
class DefaultCacheFactory extends AbstractCacheFactory (View source)
Creates the following cache adapters:
PhpFilesAdapter
(falls back toFilesystemAdapter
ifPhpFilesAdapter
isn't supported)- An optional in-memory cache such as Redis, Memcached, or APCu.
Properties
protected | LoggerInterface|null | $logger | from AbstractCacheFactory | |
protected | array | $args |
Methods
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.
from
AbstractCacheFactory
protected
CacheInterface
prepareCacheForUse(CacheInterface $cacheAdapter, bool $useInjector)
Prepare a cache adapter for use.
from
AbstractCacheFactory
protected
CacheInterface
instantiateCache(string $class, array $args, bool $useInjector)
Instantiates a cache adapter, either via the dependency injector or using the new keyword.
from
AbstractCacheFactory
Details
__construct(array $args = [], LoggerInterface|null $logger = null)
No description
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:
protected CacheInterface
prepareCacheForUse(CacheInterface $cacheAdapter, bool $useInjector)
Prepare a cache adapter for use.
This wraps a PSR6 adapter inside a PSR16 one. It also adds the loggers.
protected CacheInterface
instantiateCache(string $class, array $args, bool $useInjector)
Instantiates a cache adapter, either via the dependency injector or using the new keyword.
protected bool
addLogger(CacheInterface $cache)
No description
object|null
create(string $service, array $args = [])
No description
protected bool
isPHPFilesSupported()
Determine if PHP files is supported