diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2019-10-07 18:19:20 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2019-10-07 18:21:03 +0200 |
commit | 734527370d1074edc2d9eadf191a6bc28fcd3dc2 (patch) | |
tree | e4a71fef80ff6928282fcd2439e3dace96726368 /web/lib/aurjson.class.php | |
parent | f804ea4abb8001ddcc2cbc5bbb59d5f85c68b737 (diff) | |
download | aur-734527370d1074edc2d9eadf191a6bc28fcd3dc2.tar.gz aur-734527370d1074edc2d9eadf191a6bc28fcd3dc2.tar.xz |
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 <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/aurjson.class.php')
-rw-r--r-- | web/lib/aurjson.class.php | 6 |
1 files changed, 4 insertions, 2 deletions
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); } |