Closed dmke closed 2 years ago
Current plan is to use a generic retention-policy
query parameter, since this is not specific to the dir
adapter (any adapter is free to ignore or err when encountering these parameters, though).
Possible values:
retention-policy=keep
- do nothing (the default, at least for dir
adapter)retention-policy=purge-on-start
- clears files on start-upretention-policy=access
- use an access list to delete least used files, with the following limits:
access-quota=<bytes>
- let cache grow up to <bytes>
in size; allow common suffixes (100m
= 100×1024×1024)access-max-items=<num>
- keep the most used <num>
files
Currently, texd saves files sent with
application/x.texd; ref=store
content type on disk, but never deletes them.Users should be able to define a retention policy using the DSN. For the
dir
adapter, DSN parameters could look like this:dir://./refs?keep=7d
- to keep files for (at least) 7d before deletingSince a file's
atime
attribute is unreliable (nowadays, Linux file systems are mounted withnoatime
option), we need to either update the reference'smtime
on access, or come up with an alternative.@corny suggested to keep an in-memory map (from reference hash to last-access timestamp), and prime it on startup with the
mtime
of existing reference files. I like that idea.