If I create a cache with a 1-hour TTL, but then either:
a) Call delete after 15 minutes, or
b) Call update after 15 minutes to shorten the total TTL to 30 minutes (letting it expire naturally then),
…is the storage cost based on the actual final lifetime (15 mins for ‘a’, 30 mins for ‘b’), or am I billed for the originally set 1-hour TTL duration regardless?
Hey @Jack_Ritcher . Based on the Gemini API documentation for explicit caching, here’s how the storage costs are calculated in your scenarios:
a) Calling delete after 15 minutes : Even if you delete the cache entry after 15 minutes, you will still be billed for the originally set 1-hour TTL duration. The billing for explicit caching is tied to the duration you initially specified for the cache to exist. Once you set a TTL, the cost is calculated based on that duration, regardless of whether you manually delete the data sooner.
b) Calling update after 15 minutes to shorten the total TTL to 30 minutes : If you update the cached data and, in doing so, shorten the TTL to a total of 30 minutes (15 minutes remaining from the update), you will be billed based on this new, shorter 30-minute TTL. When you update the TTL, you are effectively telling the system the new intended lifespan of the cached data, and the billing will adjust accordingly.
For more info on this you can go through Context caching | Gemini API | Google AI for Developers.
Please let me know if you have any further questions or if anything in my explanation is unclear!