Skip to content

Commit 7393d88

Browse files
committed
cascade
1 parent 697608c commit 7393d88

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

packages/cloud-ops/src/AppConfig.php

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Closure;
66
use Craft;
7+
use craft\cache\DbCache;
78
use craft\cachecascade\CascadeCache;
9+
use craft\db\Table;
810
use craft\helpers\App;
911
use yii\caching\ArrayCache;
1012
use yii\redis\Cache as RedisCache;
@@ -70,23 +72,29 @@ private function getSessionConfig(): Closure
7072
private function getCacheConfig(): Closure
7173
{
7274
return function() {
73-
$defaultDuration = Craft::$app->getConfig()->getGeneral()->cacheDuration;
74-
75-
$valkey = $this->resolveValkeyEndpoint();
76-
77-
$primaryCache = $valkey ? [
78-
'class' => RedisCache::class,
79-
'defaultDuration' => $defaultDuration,
80-
'redis' => [
81-
'class' => Redis::class,
82-
'url' => $valkey,
83-
'database' => 0,
84-
],
85-
] : [
86-
'class' => \craft\cache\DbCache::class,
87-
'cacheTable' => \craft\db\Table::CACHE,
88-
'defaultDuration' => $defaultDuration,
89-
];
75+
// $defaultDuration = Craft::$app->getConfig()->getGeneral()->cacheDuration;
76+
77+
// $valkey = $this->resolveValkeyEndpoint();
78+
//
79+
// $primaryCache = $valkey ? [
80+
// 'class' => RedisCache::class,
81+
// 'defaultDuration' => $defaultDuration,
82+
// 'redis' => [
83+
// 'class' => Redis::class,
84+
// 'url' => $valkey,
85+
// 'database' => 0,
86+
// ],
87+
// ] : [
88+
// 'class' => \craft\cache\DbCache::class,
89+
// 'cacheTable' => \craft\db\Table::CACHE,
90+
// 'defaultDuration' => $defaultDuration,
91+
// ];
92+
93+
$primaryCache = $this->tableExists(Table::CACHE) ? [
94+
'class' => DbCache::class,
95+
'cacheTable' => Table::CACHE,
96+
'defaultDuration' => Craft::$app->getConfig()->getGeneral()->cacheDuration,
97+
] : App::cacheConfig();
9098

9199
return Craft::createObject([
92100
'class' => CascadeCache::class,

0 commit comments

Comments
 (0)