Add thread-local caches for repeated types