@paperbits/common
Version:
Paperbits common components.
14 lines (11 loc) • 565 B
text/typescript
import { IObjectStorage } from "../persistence";
import { IInjector, IInjectorModule } from "../injection";
import { CacheObjectStorage } from "./cachedObjectStorage";
export class CacheStorageModule implements IInjectorModule {
public register(injector: IInjector): void {
const underlyingObjectStorage = injector.resolve<IObjectStorage>("objectStorage");
injector.bindSingletonFactory<IObjectStorage>("objectStorage", (ctx: IInjector) => {
return new CacheObjectStorage(underlyingObjectStorage);
});
}
}