Skip to content

Commit fbfb886

Browse files
committed
modify: 디렉토리 세팅 변경
1 parent 41f0f84 commit fbfb886

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export class CacheError extends Error {
2+
constructor(message: string, public readonly code?: string) {
3+
super(message);
4+
this.name = 'CacheError';
5+
}
6+
}
7+
8+
export class CacheConnectionError extends CacheError {
9+
constructor(message: string) {
10+
super(message, 'CONNECTION_ERROR');
11+
this.name = 'CacheConnectionError';
12+
}
13+
}
14+
15+
export class CacheOperationError extends CacheError {
16+
constructor(message: string, operation: string) {
17+
super(message, `OPERATION_ERROR_${operation.toUpperCase()}`);
18+
this.name = 'CacheOperationError';
19+
}
20+
}

src/modules/cache/cache.type.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export interface CacheConfig {
2+
host: string;
3+
port: number;
4+
password?: string;
5+
db?: number;
6+
keyPrefix?: string;
7+
maxSize?: number;
8+
defaultTTL?: number;
9+
strategy?: 'lru' | 'ttl' | 'combined';
10+
}
11+
12+
export interface CacheMetadata {
13+
key: string;
14+
size: number;
15+
createdAt: number;
16+
lastAccessed: number;
17+
accessCount: number;
18+
ttl?: number;
19+
expiresAt?: number;
20+
}
21+
22+
export interface ICache {
23+
get<T>(key: string): Promise<T | null>;
24+
set<T>(key: string, value: T, ttlSeconds?: number): Promise<void>;
25+
delete(key: string): Promise<boolean>;
26+
exists(key: string): Promise<boolean>;
27+
clear(pattern?: string): Promise<void>;
28+
size(): Promise<number>;
29+
}
30+

src/modules/cache/interfaces/ICache.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)