mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-09-04 08:02:22 +00:00
![Travis Ralston](/assets/img/avatar_default.png)
This is part of a rewrite for Dimension to better support integrations. Only the bare minimum scalar APIs are implemented at this point - dimension is non-functional.
25 lines
509 B
TypeScript
25 lines
509 B
TypeScript
import * as cache from "memory-cache";
|
|
|
|
export class MemoryCache {
|
|
|
|
private internalCache = new cache.Cache();
|
|
|
|
constructor() {
|
|
}
|
|
|
|
public put(key: string, value: any, timeoutMs?: number): void {
|
|
this.internalCache.put(key, value, timeoutMs);
|
|
}
|
|
|
|
public get(key: string): any {
|
|
return this.internalCache.get(key);
|
|
}
|
|
|
|
public del(key: string): void {
|
|
this.internalCache.del(key);
|
|
}
|
|
|
|
public clear(): void {
|
|
this.internalCache.clear();
|
|
}
|
|
} |