UNPKG

@paperbits/common

Version:
14 lines (11 loc) 565 B
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); }); } }