dircache module includes a function for caching directory listings. The main function in the
dircache API is
listdir(), a wrapper around
os.listdir() that caches the results and returns the same list each time it is called with the a path unless the modification date of the named directory changes.