feat: add memory cache to boost performance (#2620)

* feat: add memory cache to boost performance

* fix: tests

* fix: logging

* fix: missing commented stuff
This commit is contained in:
Jérémy M
2023-11-21 18:29:31 +01:00
committed by GitHub
parent 74e0122294
commit dd125ddfcc
27 changed files with 458 additions and 17 deletions
@@ -0,0 +1,21 @@
import { MemoryStorageDriver } from 'src/integrations/memory-storage/drivers/interfaces/memory-storage-driver.interface';
export class MemoryStorageService<T> implements MemoryStorageDriver<T> {
private driver: MemoryStorageDriver<T>;
constructor(driver: MemoryStorageDriver<T>) {
this.driver = driver;
}
write(params: { key: string; data: T }): Promise<void> {
return this.driver.write(params);
}
read(params: { key: string }): Promise<T | null> {
return this.driver.read(params);
}
delete(params: { key: string }): Promise<void> {
return this.driver.delete(params);
}
}