Add items to the cache during enumeration if the cache size is unlimited, or if the cache isn't full.
Bug fix: The internal cache retains keys, not copy, for performance. So it's an error to put mutable keys in the cache.