I want to invalidate some locally generated cache every time file is modified. Invalidation would happen on running manually some command-line tool (no live watch required)
My approach would be to:
- First generate cache and store file modification date.
- On consequent runs check if file modification date is different from the one stored - if yes: invalidate cache, and generate it again.
Is using file modification date enough for this approach to be reliable, or should I also check file shortcuts (some hash function) if file modification date hasn't changed (false positives are not a problem, but cache needs to be invalidated every time file has changed).
File will be shared using VCS and cloud storage like Dropbox or OneDrive.
Question is OS agnostic (i.e. it has to work on every commonly used operating system (Windows, Mac OS, other POSIX compliant)).