aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/utilities/cache.ts
diff options
context:
space:
mode:
Diffstat (limited to 'code/app/src/utilities/cache.ts')
-rw-r--r--code/app/src/utilities/cache.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/code/app/src/utilities/cache.ts b/code/app/src/utilities/cache.ts
index db9be9a..101f192 100644
--- a/code/app/src/utilities/cache.ts
+++ b/code/app/src/utilities/cache.ts
@@ -1,11 +1,10 @@
-import { Temporal } from "temporal-polyfill";
-import { log_debug } from "$utilities/logger";
+import {Temporal} from "temporal-polyfill";
let cache = {};
export const CacheKeys = {
- isAuthenticated: "isAuthenticated"
-}
+ isAuthenticated: "isAuthenticated",
+};
export async function cached_result_async<T>(key: string, staleAfterSeconds: number, get_result: any, forceRefresh: boolean = false) {
if (!cache[key]) {
@@ -21,7 +20,7 @@ export async function cached_result_async<T>(key: string, staleAfterSeconds: num
cache[key].l = Temporal.Now.instant().epochSeconds;
}
- log_debug("Ran cached_result_async", {
+ console.debug("Ran cached_result_async", {
cacheKey: key,
isStale,
cache: cache[key],
@@ -34,5 +33,5 @@ export async function cached_result_async<T>(key: string, staleAfterSeconds: num
export function clear_cache_key(key: string) {
if (!key) throw new Error("No key was specified");
cache[key].c = undefined;
- log_debug("Cleared cache with key: " + key);
+ console.debug("Cleared cache with key: " + key);
} \ No newline at end of file