Skip to content

Commit c8f763d

Browse files
committed
Increase cache duration for security advisories
1 parent cd7b144 commit c8f763d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Entity/SecurityAdvisoryRepository.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ public function searchSecurityAdvisories(array $packageNames, int $updatedSince)
184184
if ($useCache) {
185185
$cacheData = [];
186186
foreach ($packageNames as $name) {
187-
$this->redisCache->setex('sec-adv:'.$name, 86400 + random_int(0, 3600), isset($advisories[$name]) ? json_encode($advisories[$name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : 'false');
187+
// Cache for 7 days with a random 1-hour variance, the cache is busted by SecurityAdvisoryUpdateListener when advisories change
188+
$this->redisCache->setex('sec-adv:'.$name, 604800 + random_int(0, 3600), isset($advisories[$name]) ? json_encode($advisories[$name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : 'false');
188189
}
189190
}
190191
}

0 commit comments

Comments
 (0)