@axah/cache
Advanced tools
Comparing version 0.0.0-20240326091405 to 0.0.0-20240326092236
export type Backend = { | ||
get(key: string): Promise<any>; | ||
get<T>(key: string): Promise<T | undefined>; | ||
set<T>(key: string, value: T, ttl: number): Promise<T>; | ||
@@ -4,0 +4,0 @@ delete(key: string): Promise<void>; |
@@ -16,5 +16,5 @@ import type { Logger } from 'pino'; | ||
export default function createCache(options: CacheOptions, log: Logger): Promise<Backend>; | ||
export declare function cached<ARGS extends ReadonlyArray<any>, RESULT>(options: CacheOptions, log: Logger, ttl: number, fn: (...ARGS: ARGS) => Promise<RESULT> | RESULT, keyCreator: (...ARGS: ARGS) => NotUndefined, cleanup: { | ||
export declare function cached<ARGS extends ReadonlyArray<NotUndefined>, RESULT>(options: CacheOptions, log: Logger, ttl: number, fn: (...ARGS: ARGS) => Promise<RESULT> | RESULT, keyCreator: (...ARGS: ARGS) => NotUndefined, cleanup: { | ||
addListener(fn: () => Promise<void>): void; | ||
}): (...ARGS: ARGS) => Promise<RESULT>; | ||
export {}; |
@@ -22,3 +22,3 @@ "use strict"; | ||
default: | ||
throw new Error(`Unknown cache type ${options.type}`); | ||
throw new Error(`Unknown cache type ${JSON.stringify(options)}`); | ||
} | ||
@@ -25,0 +25,0 @@ } |
{ | ||
"name": "@axah/cache", | ||
"version": "0.0.0-20240326091405", | ||
"version": "0.0.0-20240326092236", | ||
"description": "Provides a cache either backed by RAM or redis", | ||
@@ -11,17 +11,17 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@axah/eslint-config": "^2.0.0", | ||
"@axah/tsconfig": "^1.0.3", | ||
"@changesets/cli": "^2.26.0", | ||
"@types/jest": "^29.2.4", | ||
"@types/node": "^18.11.17", | ||
"eslint": "^8.30.0", | ||
"jest": "^29.3.1", | ||
"node-dev": "^7.4.3", | ||
"pino": "^8.8.0", | ||
"prettier": "^2.8.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^29.0.3", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.4", | ||
"@types/object-hash": "^3.0.6" | ||
"@axah/eslint-config": "^3.0.0", | ||
"@axah/tsconfig": "^1.1.0", | ||
"@changesets/cli": "^2.27.1", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.11.30", | ||
"@types/object-hash": "^3.0.6", | ||
"eslint": "^8.57.0", | ||
"jest": "^29.7.0", | ||
"node-dev": "^8.0.0", | ||
"pino": "^8.19.0", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5", | ||
"ts-jest": "^29.1.2", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.3" | ||
}, | ||
@@ -32,4 +32,4 @@ "peerDependencies": { | ||
"dependencies": { | ||
"redis": "^4.5.1", | ||
"object-hash": "^3.0.0" | ||
"object-hash": "^3.0.0", | ||
"redis": "^4.6.13" | ||
}, | ||
@@ -36,0 +36,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13392
Updatedredis@^4.6.13