Add primitive caching.