Merged in feature/warmup (pull request #1887)
* unified warmup function Approved-by: Linus Flood
This commit is contained in:
@@ -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>
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user