Support for cached usage responses
Orb now supports returning precomputed responses on the subscription costs, customer costs, and subscription usage endpoints as an opt-in feature through the `Orb-Cache-Control` header.
By default, these endpoints will query the latest events for the resource and execute a live query. For large time ranges, event sets, or many metrics, this can take a few seconds. However, Orb also periodically recomputes usage totals for each customer asynchronously as events are ingested and can now directly serve this data if requested without performing the live query.
Note that cached data is not guaranteed to be entirely fresh, and is meant to serve use cases like an initial load where performance on the critical path is important. In the response, Orb returns a timestamp, which represents the latest time the results are guaranteed to capture. This timestamp can be used to display the freshness to the user, or for your system to decide whether re-querying the endpoint for the latest data is required.
In order to request cached data on these supported endpoints, see this docs page for a more detailed explanation of request and response semantics.