Fix JIT Config Adapter caching

This commit is contained in:
Philipp 2021-03-28 23:25:16 +02:00
parent cefeb02517
commit b2a7c5ff6c
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
6 changed files with 174 additions and 4 deletions

View file

@ -86,7 +86,7 @@ class JitConfig extends BaseConfig
$dbvalue = $this->configModel->get($cat, $key);
if (isset($dbvalue)) {
$this->configCache->set($cat, $key, $dbvalue);
$this->configCache->set($cat, $key, $dbvalue, Cache::SOURCE_DB);
unset($dbvalue);
}
@ -105,7 +105,7 @@ class JitConfig extends BaseConfig
public function set(string $cat, string $key, $value)
{
// set the cache first
$cached = $this->configCache->set($cat, $key, $value);
$cached = $this->configCache->set($cat, $key, $value, Cache::SOURCE_DB);
// If there is no connected adapter, we're finished
if (!$this->configModel->isConnected()) {

View file

@ -81,7 +81,7 @@ class PreloadConfig extends BaseConfig
if ($this->configModel->isConnected()) {
$config = $this->configModel->get($cat, $key);
if (isset($config)) {
$this->configCache->set($cat, $key, $config);
$this->configCache->set($cat, $key, $config, Cache::SOURCE_DB);
}
}
}
@ -102,7 +102,7 @@ class PreloadConfig extends BaseConfig
}
// set the cache first
$cached = $this->configCache->set($cat, $key, $value);
$cached = $this->configCache->set($cat, $key, $value, Cache::SOURCE_DB);
// If there is no connected adapter, we're finished
if (!$this->configModel->isConnected()) {
@ -133,4 +133,18 @@ class PreloadConfig extends BaseConfig
return $cacheRemoved || $storeRemoved;
}
public function testSetDouble()
{
$this->configModel->shouldReceive('isConnected')
->andReturn(true);
// constructor loading
$this->configModel->shouldReceive('load')
->with('config')
->andReturn(['config' => ['test' => 'it']])
->once();
parent::testSetDouble();
}
}