Right now, the generic file cache code doesn't cache anything. This works, but it is suboptimal since the consumers always think that the underlying file has changed. We can do better than this.
Much like the event ports version, we can keep per-file stat info in memory. Then when it is time to answer whether or not a a file has changed, we can do a stat(2) and compare the result with the in-memory info.
We don't actually have to cache the file contents. Making file_cache_has_newer return a truthful value (based on stat(2)) will prevent a number of calls to file_cache_get by the consumers. That alone should be a win.