[eluser]sophistry[/eluser]
now, are you ready to do some tests that show that this is an optimization over simply reading the directory tree each time?
i'd bet that you'd have to have some pretty deep trees and thousands of files to see any benefit to building out this whole set of code.