UNPKG

pip-services3-components-nodex

Version:
30 lines (26 loc) 1.07 kB
/** @module cache */ import { Descriptor } from 'pip-services3-commons-nodex'; import { Factory } from '../build/Factory'; import { NullCache } from './NullCache'; import { MemoryCache } from './MemoryCache'; /** * Creates [[ICache]] components by their descriptors. * * @see [[Factory]] * @see [[ICache]] * @see [[MemoryCache]] * @see [[NullCache]] */ export class DefaultCacheFactory extends Factory { public static readonly Descriptor: Descriptor = new Descriptor("pip-services", "factory", "cache", "default", "1.0"); public static readonly NullCacheDescriptor: Descriptor = new Descriptor("pip-services", "cache", "null", "*", "1.0"); public static readonly MemoryCacheDescriptor: Descriptor = new Descriptor("pip-services", "cache", "memory", "*", "1.0"); /** * Create a new instance of the factory. */ public constructor() { super(); this.registerAsType(DefaultCacheFactory.MemoryCacheDescriptor, MemoryCache); this.registerAsType(DefaultCacheFactory.NullCacheDescriptor, NullCache); } }