refactor: move cache logic into the factory (#2884)

This commit is contained in:
Dag 2022-07-05 13:20:01 +02:00 committed by GitHub
parent 5b9b579652
commit 321ec7c8c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 16 additions and 15 deletions

View file

@ -29,10 +29,11 @@ class CacheFactory
}
/**
* @param string $name The name of the cache e.g. "File", "Memcached" or "SQLite"
* @param string|null $name The name of the cache e.g. "File", "Memcached" or "SQLite"
*/
public function create(string $name): CacheInterface
public function create(string $name = null): CacheInterface
{
$name ??= Configuration::getConfig('cache', 'type');
$name = $this->sanitizeCacheName($name) . 'Cache';
if (! preg_match('/^[A-Z][a-zA-Z0-9-]*$/', $name)) {