Right now, we’ve got two options for cached data for linked tables: either cache it forever, or set up an automatic cron job.
But the cron job is only necessary when you have a high-traffic site. For simple users, that’s a comple overkill, and if you lack the tech know-how, it’s also difficult.
It would be good to have a cache expiration that is checked when the data is requested, rather than on a cron. Here’s how it’d work in pseudo-code:
IF [cache doesn’t exist] THEN
[download and cache linked data]
[set cache datetime]
ELSEIF [cache exists] AND [cache datetime + cache expiry time < now] THEN
[use cached data]
ELSE
[download and cache linked data]
[set cache datetime]
END IF
Basically, when a visitor accesses a page, the call checks if the time the data was cached plus the time to retain the cache are shorter than now, and if so, uses the cached data, otherwise, it requests data from the source and caches that (and shows it, obviously).
For example:
I set the cache expiry time to 1 hour.
At 13:00, a visitor visits the page. There is no cache, so the linked data is downloaded and cached.
At 13:15, a visitor visits the page. There is cached data, and the cache is valid for 1 hour (until 14:00) which is less than the time since the cache was last accessed. The visitor is shown cached data.
At 16:30, a visitor visits the page. There is cached data, but since it’s been more than 1 hour since it was cached, the linked data is downloaded and cached anew.