commit 2 refactor

This commit is contained in:
Boki 2026-10-20 14:35:45 -04:00
parent 588f666943
commit 32e43c9243
310 changed files with 33318 additions and 31189 deletions

View file

@ -8,18 +8,10 @@ import type { CacheOptions, CacheProvider, CacheStats } from './types';
*/
export class RedisCache implements CacheProvider {
private redis: Redis;
private logger: { info?: (...args: unknown[]) => void; error?: (...args: unknown[]) => void } =
console;
private logger: NonNullable<CacheOptions['logger']>;
private defaultTTL: number;
private keyPrefix: string;
private stats: CacheStats = {
hits: 0,
misses: 0,
errors: 0,
hitRate: 0,
total: 0,
uptime: 0,
};
private stats: CacheStats = { hits: 0, misses: 0, errors: 0, hitRate: 0, total: 0, uptime: 0 };
private startTime = Date.now();
constructor(options: CacheOptions) {

View file

@ -1,3 +1,5 @@
import type { LoggerLike } from '@stock-bot/logger';
export interface RedisConfig {
host: string;
port: number;
@ -113,12 +115,7 @@ export interface CacheOptions {
name?: string; // Name for connection identification
shared?: boolean; // Whether to use shared connection
redisConfig: RedisConfig;
logger?: {
info?: (...args: unknown[]) => void;
error?: (...args: unknown[]) => void;
warn?: (...args: unknown[]) => void;
debug?: (...args: unknown[]) => void;
};
logger?: Partial<LoggerLike>;
}
export interface CacheStats {