From 3be56dff06b1869e7937b1b939409ff0688d54a2 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Fri, 3 Jan 2025 16:59:13 +0900 Subject: [PATCH] refactor: refactor code --- src/memoize.ts | 4 ++-- src/memoizeWithPersistentCache.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/memoize.ts b/src/memoize.ts index e8890ac..42675a2 100644 --- a/src/memoize.ts +++ b/src/memoize.ts @@ -36,10 +36,10 @@ export function memoizeFactory({ calcHash = calcHashWithContext, maxCachedArgsSize = 100, }: { - maxCachedArgsSize?: number; cacheDuration?: number; - calcHash?: (self: unknown, args: unknown[]) => string; caches?: Map[]; + calcHash?: (self: unknown, args: unknown[]) => string; + maxCachedArgsSize?: number; } = {}) { return function memoize( target: ((this: This, ...args: Args) => Return) | ((...args: Args) => Return) | keyof This, diff --git a/src/memoizeWithPersistentCache.ts b/src/memoizeWithPersistentCache.ts index 0705849..a64e939 100644 --- a/src/memoizeWithPersistentCache.ts +++ b/src/memoizeWithPersistentCache.ts @@ -25,13 +25,13 @@ export function memoizeWithPersistentCacheFactory({ removeCache, tryReadingCache, }: { - maxCachedArgsSize?: number; cacheDuration?: number; - calcHash?: (self: unknown, args: unknown) => string; caches?: Map[]; + calcHash?: (self: unknown, args: unknown) => string; + maxCachedArgsSize?: number; persistCache: (persistentKey: string, hash: string, currentTime: number, value: unknown) => void; - tryReadingCache: (persistentKey: string, hash: string) => [number, unknown] | undefined; removeCache: (persistentKey: string, hash: string) => void; + tryReadingCache: (persistentKey: string, hash: string) => [number, unknown] | undefined; }) { // eslint-disable-next-line @typescript-eslint/no-explicit-any return function (