{"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,YAAmB,QAA4B;EAC7C,KAAK,SAAS,IAAI,kBAAkB,MAAM;CAC5C;CAEA,SAAgB,mBAAsC;EACpD,kBAAkB,iBAAiB,mBAAmB,KAAK,MAAM;EAIjE,IAAI,KAAK,OAAO,yBACd,kBAAkB,kBAAkB,oBAAoB;EAI1D,IAAI,KAAK,OAAO,iBAAiB,8BAC/B,kBAAkB,kBAAkB,+BAA+B;CAEvE;AACF"}