We have a REST API, and certain items for a specific org/token do not change very often. When GET requests arrive for those specific items, with a specific token, on a specific URL path - we’d like to implement a 5-minute cache for them. We’re okay with such items being potentially stale for 5 minutes, but they must be refreshed if requested after 5 minutes have elapsed.
- How long does it take to invalidate cache via the API, everywhere?
- Similar to (1) - how long before a newly cached item shows up everywhere?
- How do you calculate time elapsed e.g. 5 minutes - to know when to refresh the cache again?
- Can anyone propose any sample worker code that would implement such a timestamp based caching schema based on a primitive “keep-cached” time of 5 minutes since the object was last cached?