Patch Set 1: I would prefer that you didn't submit this

Are we sure callers don't except a new object to be created, thereby ensuring thread safety? With this multiple threads will get the same object and strange things will happen.

I think caching this way need more work. It might be reasable to have method that returns a shareable unmutable dircache object and another that create mutable, non-shared dircache objects.