Skip to content

Commit 9dba376

Browse files
committed
No cascadecache
1 parent 7393d88 commit 9dba376

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

packages/cloud-ops/src/AppConfig.php

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
use Closure;
66
use Craft;
77
use craft\cache\DbCache;
8-
use craft\cachecascade\CascadeCache;
98
use craft\db\Table;
109
use craft\helpers\App;
11-
use yii\caching\ArrayCache;
1210
use yii\redis\Cache as RedisCache;
1311

1412
class AppConfig
@@ -72,37 +70,28 @@ private function getSessionConfig(): Closure
7270
private function getCacheConfig(): Closure
7371
{
7472
return function() {
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) ? [
73+
$valkey = $this->resolveValkeyEndpoint();
74+
$defaultDuration = Craft::$app->getConfig()->getGeneral()->cacheDuration;
75+
76+
$config = $this->tableExists(Table::CACHE) ? [
9477
'class' => DbCache::class,
9578
'cacheTable' => Table::CACHE,
96-
'defaultDuration' => Craft::$app->getConfig()->getGeneral()->cacheDuration,
79+
'defaultDuration' => $defaultDuration,
9780
] : App::cacheConfig();
9881

99-
return Craft::createObject([
100-
'class' => CascadeCache::class,
101-
'caches' => [
102-
$primaryCache,
103-
['class' => ArrayCache::class],
104-
],
105-
]);
82+
if ($valkey) {
83+
$config = [
84+
'class' => RedisCache::class,
85+
'defaultDuration' => $defaultDuration,
86+
'redis' => [
87+
'class' => Redis::class,
88+
'url' => $valkey,
89+
'database' => 0,
90+
],
91+
];
92+
}
93+
94+
return Craft::createObject($config);
10695
};
10796
}
10897

0 commit comments

Comments
 (0)