Temporal

Caching API Calls with Long-Lived Workflows in Temporal

May 26, 2022
Caching API Calls with Long-Lived Workflows in Temporal
SummaryAI, from the source post

This post demonstrates a practical application of Temporal's durable execution for API call caching using long-lived workflows. It introduces the pattern of using a `while(true)` loop with `sleep` for scheduled API refreshes and `continueAsNew` to manage workflow state and avoid event limits. It also shows how to use Activities for external API calls and Queries for retrieving cached data, providing concrete code examples in TypeScript.

More from the Durable Execution trail