import {Instantiable, FactoryProducer} from '../../di' import {InMemCache, Maybe} from '../../util' import {Cache} from '../../util' import {ConfiguredSingletonFactory} from '../../di/factory/ConfiguredSingletonFactory' /** * Dependency container factory that matches the abstract Cache token, but * produces an instance of whatever Cache driver is configured in the `server.cache.driver` config. */ @FactoryProducer() export class CacheFactory extends ConfiguredSingletonFactory { protected getConfigKey(): string { return 'server.cache.driver' } protected getDefaultImplementation(): Instantiable { return InMemCache } protected getAbstractImplementation(): any { return Cache } protected getDefaultImplementationWarning(): Maybe { return 'You are using the default memory-based cache driver. It is recommended you configure a persistent cache driver instead.' } }