same small improvements for cache as for map