{"version":3,"file":"CacheModule.mjs","names":[],"sources":["../../../src/modules/cache/CacheModule.ts"],"sourcesContent":["import type { DependencyManager, Module } from '../../plugins'\nimport { CachedStorageService } from './CachedStorageService'\nimport type { CacheModuleConfigOptions } from './CacheModuleConfig'\n\nimport { CacheModuleConfig } from './CacheModuleConfig'\nimport { SingleContextLruCacheRepository } from './singleContextLruCache/SingleContextLruCacheRepository'\nimport { SingleContextStorageLruCache } from './singleContextLruCache/SingleContextStorageLruCache'\n\nexport type CacheModuleOptions = CacheModuleConfigOptions\n\nexport class CacheModule implements Module {\n  public readonly config: CacheModuleConfig\n\n  public constructor(config: CacheModuleOptions) {\n    this.config = new CacheModuleConfig(config)\n  }\n\n  public register(dependencyManager: DependencyManager) {\n    dependencyManager.registerInstance(CacheModuleConfig, this.config)\n\n    // Allows us to use the `CachedStorageService` instead of the `StorageService`\n    // This first checks the local cache to return a record\n    if (this.config.useCachedStorageService) {\n      dependencyManager.registerSingleton(CachedStorageService)\n    }\n\n    // Custom handling for when we're using the SingleContextStorageLruCache\n    if (this.config.cache instanceof SingleContextStorageLruCache) {\n      dependencyManager.registerSingleton(SingleContextLruCacheRepository)\n    }\n  }\n}\n"],"mappings":";;;;;;;;AAUA,IAAa,cAAb,MAA2C;CAGzC,AAAO,YAAY,QAA4B;AAC7C,OAAK,SAAS,IAAI,kBAAkB,OAAO;;CAG7C,AAAO,SAAS,mBAAsC;AACpD,oBAAkB,iBAAiB,mBAAmB,KAAK,OAAO;AAIlE,MAAI,KAAK,OAAO,wBACd,mBAAkB,kBAAkB,qBAAqB;AAI3D,MAAI,KAAK,OAAO,iBAAiB,6BAC/B,mBAAkB,kBAAkB,gCAAgC"}