[ ] We cache package icons now but we don't keep track of how much cache space we're using.
[x] We don't ever check for new versions of images.
To work around this, I think we could make a table in the sqlite database and store last_miss_timestamp and last_hit_timestamp - the miss timestamp gets updated when when we cache an image from HTTP. The hit timestamp gets updated when we pull an image from cache.
When we want to check for new versions of images (we'll do this and just consider it a miss if it's too old), we'll check cache_miss_timestamp. When we want to check if we should delete an image we haven't used in a long time, we can check the cache_hit_timestamp.
We can clean old cache images that haven't been used in a long time whenever we want (on app startup, e.g.).
We can update the hit timestamp and check the miss timestamp each time we load an image. If the miss timestamp is old, mark it as a miss and repull it.
There's a few issues here:
To work around this, I think we could make a table in the sqlite database and store
last_miss_timestamp
andlast_hit_timestamp
- the miss timestamp gets updated when when we cache an image from HTTP. The hit timestamp gets updated when we pull an image from cache.When we want to check for new versions of images (we'll do this and just consider it a miss if it's too old), we'll check
cache_miss_timestamp
. When we want to check if we should delete an image we haven't used in a long time, we can check thecache_hit_timestamp
.We can clean old cache images that haven't been used in a long time whenever we want (on app startup, e.g.).
We can update the hit timestamp and check the miss timestamp each time we load an image. If the miss timestamp is old, mark it as a miss and repull it.