Merged in fix/cache-service-token (pull request #1571)

fix(servicetoken): cache it when using unstable_cache

* fix(servicetoken): cache it when using unstable_cache

* Refactor and using cacheOrGet as get/set

* Refactor

* Use expiresAt from cached token


Approved-by: Anton Gunnarsson
This commit is contained in:
Linus Flood
2025-03-19 09:16:11 +00:00
parent 8d1e9954d4
commit dd3fed9423
3 changed files with 34 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ import { cacheLogger } from "../../logger"
export const cacheOrGet: DataCache["cacheOrGet"] = async <T>(
key: string | string[],
callback: (overrideTTL?: (cacheTime: CacheTime) => void) => Promise<T>,
callback: () => Promise<T>,
ttl: CacheTime
): Promise<T> => {
if (!Array.isArray(key)) {