-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Currently the cache directory growth is unbounded and garbage (i.e. cached content not referenced from a cached response) isn't collected.
The default cache storage implementation should take configuration relating to how large the cache should grow to (in terms of bytes) and how often garbage collection should be performed. The maximum size default might be 100 MiB.
We'll need a new advisory lock at the root of the cache, like <dir>/v1/.lock
to coordinate operations against the entire cache. Storage should take a shared lock on this file during normal operation.
Occasionally (by a mechanism TBD), a garbage collection should occur upon which an exclusive lock on the cache is acquired and garbage should be collected. It should then determine if the size of the cache is still exceeding the maximum.
If the cache is still above the maximum, it should consider a trade-off between deleting the largest stored content with the least-recently-accessed requests.