You say:
If the entry has no mtime in the metadata, this checks the cache and
uses that. If there's nothing in the cache, this checks the file's mtime.
This adds the mtime to the entry metadata.
but I thought the primary use case would be to generate the cache.
I also think that the order of canonicality should be
metadata (most canonical)
mtime
cache (least canonical, but fastest)
So that would make the workflow look more like:
If the entry has an mtime in the metadata,
set the file's mtime and
set it in the cache.
If there's nothing in the metadata, get the file's mtime,
add it to the metadata and
set it in the cache.
Then, at entry display time, use the cache for items that are in the cache, and
the mtime for items that aren't. (And possibly notify someone that we should
run sync-mtimes…)
Open Question: given the hopefully rare occurrence of cache misses, should we
check the metadata as well as the mtime if an item isn't in the cache?
|