From 20e85282f1bae9859ade288f73f2f9a741078242 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 24 May 2026 22:33:15 -0700 Subject: [PATCH] Export cache as object only. --- src/utils/cache.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 6e86a3f..f40ddb9 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -28,11 +28,11 @@ function setItem (key: string, item: string): void { storage[key] = item } -export function clear (): void { +function clear (): void { removeItem(STORAGE_KEY) } -export function get (hash: bigint, difficulty: bigint): WorkGenerateResponse | null { +function get (hash: bigint, difficulty: bigint): WorkGenerateResponse | null { const item = getItem(STORAGE_KEY) if (item == null) return null const cache: WorkGenerateResponse[] = JSON.parse(item) @@ -40,7 +40,7 @@ export function get (hash: bigint, difficulty: bigint): WorkGenerateResponse | n return match ?? null } -export function remove (hash: bigint): void { +function remove (hash: bigint): void { const item = getItem(STORAGE_KEY) if (item == null) return const cache = JSON.parse(item) as WorkGenerateResponse[] @@ -52,7 +52,7 @@ export function remove (hash: bigint): void { setItem(STORAGE_KEY, JSON.stringify(cache)) } -export function set (result: WorkGenerateResponse): WorkGenerateResponse { +function set (result: WorkGenerateResponse): WorkGenerateResponse { const item = getItem(STORAGE_KEY) ?? '[]' const cache: WorkGenerateResponse[] = JSON.parse(item) if (cache.push(result) > 1000) cache.shift() -- 2.52.0