Ejemplo n.º 1
0
        public Cache(IBackingStore backingStore, CacheCapacityScavengingPolicy scavengingPolicy)
        {
            this.backingStore = backingStore;
            this.scavengingPolicy = scavengingPolicy;

            Hashtable initialItems = backingStore.Load();
            inMemoryCache = Hashtable.Synchronized(initialItems);

            CachingServiceItemTurnoverEvent.SetItemsTotal(Count);
        }
Ejemplo n.º 2
0
        public Cache(IBackingStore backingStore, CacheCapacityScavengingPolicy scavengingPolicy)
        {
            this.backingStore     = backingStore;
            this.scavengingPolicy = scavengingPolicy;

            Hashtable initialItems = backingStore.Load();

            inMemoryCache = Hashtable.Synchronized(initialItems);

            CachingServiceItemTurnoverEvent.SetItemsTotal(Count);
        }
Ejemplo n.º 3
0
		/// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <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);
        }