Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hash } from 'node:crypto';
import type { CacheInterface } from 'descript';
import type { CacheInterface, LoggerInterface } from 'descript';
import { error as deError } from 'descript';
import type { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
import { Cluster, Redis } from 'ioredis';
Expand All @@ -21,9 +21,7 @@ interface InnerOptions extends Options {
readTimeout: number;
}

interface Logger {
log(event: LoggerEvent): void;
}
type Logger = LoggerInterface<LoggerEvent>;

interface Timers {
start: number;
Expand All @@ -35,10 +33,6 @@ export type LoggerEvent = (
type: EVENT.REDIS_CACHE_INITIALIZED;
options: Options
} |
{
type: EVENT.REDIS_CACHE_ERROR;
error: Error;
} |
{
type: EVENT.REDIS_CACHE_READ_START;
key: string;
Expand Down Expand Up @@ -93,7 +87,7 @@ export type LoggerEvent = (
} |
{
type: EVENT.REDIS_CACHE_WRITE_ERROR;
error: unknown;
error: Error;
key: string;
normalizedKey: string;
timers: Timers
Expand Down Expand Up @@ -355,7 +349,6 @@ export class Cache<Result> implements CacheInterface<Result> {

export enum EVENT {
REDIS_CACHE_INITIALIZED= 'REDIS_CACHE_INITIALIZED',
REDIS_CACHE_ERROR= 'REDIS_CACHE_ERROR',

REDIS_CACHE_JSON_PARSING_FAILED = 'REDIS_CACHE_JSON_PARSING_FAILED',
REDIS_CACHE_JSON_STRINGIFY_FAILED = 'REDIS_CACHE_JSON_STRINGIFY_FAILED',
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@stylistic/eslint-plugin-ts": "^2.11.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.10.0",
"descript": "^4.0.5",
"descript": "^4.0.6",
"eslint": "^9.15.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
Expand Down
Loading