Implemented user deserialize cache
This commit is contained in:
19
api/src/services/cache/cache.ts
vendored
Normal file
19
api/src/services/cache/cache.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export class CacheService<Key, Value> {
|
||||
private cacheMap: Map<Key, Value>
|
||||
|
||||
constructor() {
|
||||
this.cacheMap = new Map<Key, Value>();
|
||||
}
|
||||
|
||||
public Get(key: Key): Value {
|
||||
return this.cacheMap.get(key)
|
||||
}
|
||||
|
||||
public Set(key: Key, value: Value) {
|
||||
this.cacheMap.set(key, value);
|
||||
}
|
||||
|
||||
public Invalidate(key: Key): boolean {
|
||||
return this.cacheMap.delete(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user