Refactored Configuration

This commit is contained in:
netkas 2024-10-24 15:15:14 -04:00
parent 5eeb06805a
commit 5555e79327
11 changed files with 247 additions and 46 deletions

View file

@ -22,10 +22,10 @@ class MemcachedCacheLayer extends CacheLayer
}
$this->memcached = new Memcached();
$this->memcached->addServer(Configuration::getConfiguration()['cache']['host'], (int)Configuration::getConfiguration()['cache']['port']);
if(Configuration::getConfiguration()['cache']['username'] !== null || Configuration::getConfiguration()['cache']['password'] !== null)
$this->memcached->addServer(Configuration::getCacheConfiguration()->getHost(), Configuration::getCacheConfiguration()->getPort());
if(Configuration::getCacheConfiguration()->getUsername() !== null || Configuration::getCacheConfiguration()->getPassword() !== null)
{
$this->memcached->setSaslAuthData(Configuration::getConfiguration()['cache']['username'], Configuration::getConfiguration()['cache']['password']);
$this->memcached->setSaslAuthData(Configuration::getCacheConfiguration()->getUsername(), Configuration::getCacheConfiguration()->getPassword());
}
}

View file

@ -26,15 +26,15 @@ class RedisCacheLayer extends CacheLayer
try
{
$this->redis->connect(Configuration::getConfiguration()['cache']['host'], (int)Configuration::getConfiguration()['cache']['port']);
if (Configuration::getConfiguration()['cache']['password'] !== null)
$this->redis->connect(Configuration::getCacheConfiguration()->getHost(), Configuration::getCacheConfiguration()->getPort());
if (Configuration::getCacheConfiguration()->getPassword() !== null)
{
$this->redis->auth(Configuration::getConfiguration()['cache']['password']);
$this->redis->auth(Configuration::getCacheConfiguration()->getPassword());
}
if (Configuration::getConfiguration()['cache']['database'] !== 0)
if (Configuration::getCacheConfiguration()->getDatabase() !== null)
{
$this->redis->select((int)Configuration::getConfiguration()['cache']['database']);
$this->redis->select(Configuration::getCacheConfiguration()->getDatabase());
}
}
catch (RedisException $e)