public Cache(IBackingStore backingStore, CacheCapacityScavengingPolicy scavengingPolicy) { this.backingStore = backingStore; this.scavengingPolicy = scavengingPolicy; Hashtable initialItems = backingStore.Load(); inMemoryCache = Hashtable.Synchronized(initialItems); CachingServiceItemTurnoverEvent.SetItemsTotal(Count); }
/// <summary> /// Initialzie a new instance of a <see cref="Cache"/> class with a backing store, and scavenging policy. /// </summary> /// <param name="backingStore">The cache backing store.</param> /// <param name="scavengingPolicy">The scavenging policy.</param> /// <param name="instrumentationProvider">The instrumentation provider.</param> public Cache(IBackingStore backingStore, CacheCapacityScavengingPolicy scavengingPolicy, CachingInstrumentationProvider instrumentationProvider) { this.backingStore = backingStore; this.scavengingPolicy = scavengingPolicy; this.instrumentationProvider = instrumentationProvider; Hashtable initialItems = backingStore.Load(); inMemoryCache = Hashtable.Synchronized(initialItems); this.instrumentationProvider.FireCacheUpdated(initialItems.Count, initialItems.Count); }
/// <summary> /// </summary> /// <param name="backingStore">Резервное хранилище.</param> /// <param name="instrumentationProvider">Инструментарий для событий</param> public Cache(IBackingStore backingStore, ICachingInstrumentationProvider instrumentationProvider) { if (backingStore == null) throw new ArgumentNullException("backingStore"); if (instrumentationProvider == null) throw new ArgumentNullException("instrumentationProvider"); this.backingStore = backingStore; this.instrumentationProvider = instrumentationProvider; var initialItems = backingStore.Load(); inMemoryCache = Hashtable.Synchronized(initialItems); this.instrumentationProvider.FireCacheUpdated(initialItems.Count, initialItems.Count); }
/// <summary> /// Initialzie a new instance of a <see cref="Cache"/> class with a backing store, and scavenging policy. /// </summary> /// <param name="backingStore">The cache backing store.</param> /// <param name="instrumentationProvider">The instrumentation provider.</param> public Cache(IBackingStore backingStore, ICachingInstrumentationProvider instrumentationProvider) { if (backingStore == null) { throw new ArgumentNullException("backingStore"); } if (instrumentationProvider == null) { throw new ArgumentNullException("instrumentationProvider"); } this.backingStore = backingStore; this.instrumentationProvider = instrumentationProvider; Hashtable initialItems = backingStore.Load(); inMemoryCache = Hashtable.Synchronized(initialItems); this.instrumentationProvider.FireCacheUpdated(initialItems.Count, initialItems.Count); }