CacheTools
in package
Common cache actions.
DSN documentation:
CacheTools only handles the scheme part of the URL, the rest of the URL is described in the documentation of the parseDsn implementation of the respective backend.
The scheme can be a PHP classpath to an implementation of ICacheBackend, or any of these aliases:
-
array
,null
: maps toArrayCache\ArrayCacheBackend
orIndex-Cache-ArrayCache-ArrayCacheBackend
, uses a simple array backed cache that doesn't get saved. -
memcached
,memcache
: maps toMemcached\MemcachedBackend
orIndex-Cache-Memcached-MemcachedBackend
, provides a backend based on the memcached or memcache extension. -
valkey
,keydb
,redis
: maps toValkey\ValkeyBackend
orIndex-Cache-Valkey-ValkeyBackend
, provides a backend based on the phpredis extension.
Short names are currently hardcoded and cannot be expanded.
Table of Contents
Methods
- backend() : ICacheBackend
- Retrieves cache provider based on DSN URL.
- create() : ICacheProvider
- Uses a DSN URL to create a cache provider instance.
- parse() : ICacheProviderInfo
- Parses a DSN URL.
Methods
backend()
Retrieves cache provider based on DSN URL.
public
static backend(string $dsn) : ICacheBackend
Format of the DSN URLs are described in the documentation of the CacheTools class as a whole.
Parameters
- $dsn : string
-
URL to create cache provider from.
Tags
Return values
ICacheBackend —Cache backend instance.
create()
Uses a DSN URL to create a cache provider instance.
public
static create(string $dsn) : ICacheProvider
Format of the DSN URLs are described in the documentation of the CacheTools class as a whole.
Parameters
- $dsn : string
-
URL to create cache provider from.
Tags
Return values
ICacheProvider —A cache provider.
parse()
Parses a DSN URL.
public
static parse(string $dsn) : ICacheProviderInfo
Format of the DSN URLs are described in the documentation of the CacheTools class as a whole.
Parameters
- $dsn : string
-
URL to create cache provider from.
Tags
Return values
ICacheProviderInfo —Cache provider info.