Implements flushDirectory method for clearing cache