purge the dir cache periodically to prevent it from eating up lots of memory
move purge dir cache functionality to it's own method
reduce the number of calls to the time function