LRU approximation for database cache

Created on 25 August 2017, over 7 years ago
Updated 15 January 2025, 21 days ago

Problem/Motivation

#2526150: Database cache bins allow unlimited growth: cache DB tables of gigabytes! introduces a limit on items in the database cache, deleting the oldest cache entries in the table that go over the limit.

An issue here is that the oldest entries may well include ones requested on every page, because they're going to be amongst the first entries in the bin, this could result in entries being constantly deleted and recreated.

Proposed resolution

We could improve this by re-saving cache items with an updated created timestamp when they're requested - since this is a database write it can't be every time, but it could be done 1/1000 cache requests or so (if a page has 100 cache entries retrieved, it means about one write in ten page requests). This adds some complexity so adding it as a follow-up, but it might be necessary if sites see bad side-effects from the original patch.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: duplicate

Version

11.0 🔥

Component

cache system

Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024