Cache templates when first compiled