Greg> The problem occurs when you path is [A, B], the file is in B, and Greg> you add something to A on-the-fly. The cache might direct the Greg> importer at B, missing your file.
Typically your path will be relatively short (< 20 directories), right? Just stat the directories before consulting the cache. If any changed since the last time the cache was built, then invalidate the entire cache (or that portion of the cached information that is downstream from the first modified directory). It's still going to be cheaper than performing listdir for each directory in the path, and like you said, only require flushes during development or installation actions.