Merged in feature/warmup (pull request #1887)

* unified warmup function

Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-04-29 06:18:14 +00:00
parent bbbd665a32
commit c1505ce50e
33 changed files with 886 additions and 185 deletions
+5 -1
View File
@@ -1,3 +1,5 @@
import type { CacheOrGetOptions } from "./cacheOrGetOptions"
const ONE_HOUR_IN_SECONDS = 3_600 as const
const ONE_DAY_IN_SECONDS = 86_400 as const
@@ -60,6 +62,7 @@ export type DataCache = {
* @param key The cache key
* @param getDataFromSource An async function that provides a value to cache
* @param ttl Time to live, either a named cache time or a number of seconds
* @param opts Options to control cache behavior when retrieving or storing data.
* @returns The cached value or the result from the callback
*/
cacheOrGet: <T>(
@@ -67,7 +70,8 @@ export type DataCache = {
getDataFromSource: (
overrideTTL?: (cacheTime: CacheTime) => void
) => Promise<T>,
ttl: CacheTime
ttl: CacheTime,
opts?: CacheOrGetOptions
) => Promise<T>
/**