Home / Companies / Temporal / Blog / Post Details
Content Deep Dive

Caching API Requests With Long-Lived Workflows in Temporal

Blog post from Temporal

Post Details
Company
Date Published
Author
Valeri Karpov
Word Count
1,371
Language
English
Hacker News Points
-
Summary

A Temporal Workflow Execution has no time limit and can be used for long-lived tasks such as caching API requests. In this example, a TypeScript SDK is used to create an API caching workflow for the moneyconvert.net API. The workflow makes one API request per day to get the latest exchange rates for a set of currencies and stores the most recent result without explicit database calls or cron jobs. Temporal Workflows are deterministic, so APIs requests must be made through an Activity that is called from the Workflow. The workflow can also store historical data and use Continue-As-New to restart the workflow from an initial state when needed.