Function to add precomputed values to cache