From 734527370d1074edc2d9eadf191a6bc28fcd3dc2 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 7 Oct 2019 12:19:20 -0400 Subject: Make package details cache TTL configurable The TTL for package details can be much longer than for generic values since they never change. Note that when an update is pushed via Git, all packages belonging to that package base are deleted and new packages are created. Signed-off-by: Lukas Fleischer --- web/lib/aurjson.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/lib/aurjson.class.php') diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index bfb8cd14..1c31a65e 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -292,7 +292,8 @@ class AurJSON { "FROM Licenses INNER JOIN PackageLicenses " . "ON PackageLicenses.PackageID = " . $pkgid . " " . "AND PackageLicenses.LicenseID = Licenses.ID"; - $rows = db_cache_result($query, 'extended-fields:' . $pkgid, PDO::FETCH_ASSOC); + $ttl = config_get_int('options', 'cache_pkginfo_ttl'); + $rows = db_cache_result($query, 'extended-fields:' . $pkgid, PDO::FETCH_ASSOC, $ttl); $type_map = array( 'depends' => 'Depends', @@ -315,7 +316,8 @@ class AurJSON { $query = "SELECT Keyword FROM PackageKeywords " . "WHERE PackageBaseID = " . intval($base_id) . " " . "ORDER BY Keyword ASC"; - $rows = db_cache_result($query, 'keywords:' . intval($base_id)); + $ttl = config_get_int('options', 'cache_pkginfo_ttl'); + $rows = db_cache_result($query, 'keywords:' . intval($base_id), PDO::FETCH_NUM, $ttl); $data['Keywords'] = array_map(function ($x) { return $x[0]; }, $rows); } -- cgit v1.2.3-24-g4f1b