Add experimental threadlocal caching, used by collectstatic