コード例 #1
0
		public void RemoveEmpty()
		{
			int size = 10;
			IDictionary cache = new LRUMap(size);

			cache.Remove("key:" + 1);
		}
コード例 #2
0
		public void PutAndRemove()
		{
			int size = 10;
			IDictionary cache = new LRUMap(size);

			cache.Add("key:" + 1, "data:" + 1);
			cache.Remove("key:" + 1);
			Assert.IsNull(cache["key:" + 1]);
		}
コード例 #3
0
ファイル: Fixture.cs プロジェクト: marchlud/nhibernate-core
		public void IndexerDoesBoundsChecking()
		{
			var map = new LRUMap(128);

			for (int i = 0; i < 200; i++)
				map["str" + i] = i;

			Assert.That(map.Count, Is.EqualTo(128));
		}
コード例 #4
0
ファイル: Fixture.cs プロジェクト: marchlud/nhibernate-core
		public void AddDoesBoundsChecking()
		{
			var map = new LRUMap(128);

			for (int i = 0; i < 200; i++)
				map.Add("str" + i, i);

			Assert.That(map.Count, Is.EqualTo(128));
		}
コード例 #5
0
		public void PutWithNoSizeLimit()
		{
			int size = 10;
			IDictionary cache = new LRUMap();

			for (int i = 0; i < size; i++)
			{
				cache.Add("key:" + i, "data:" + i);
			}

			for (int i = 0; i < size; i++)
			{
				string data = (string)cache["key:" + i];
				Assert.AreEqual("data:" + i, data, "Data is wrong.");
			}
		}
コード例 #6
0
		public void GetEntrySet()
		{
			int size = 10;
			IDictionary cache = new LRUMap(size);

			for (int i = 0; i < size; i++)
			{
				cache.Add("key:" + i, "data:" + i);
			}
			Assert.AreEqual(size, cache.Keys.Count, "Set contains the wrong number of items.");

			// check minimal correctness
			foreach (DictionaryEntry entry in cache)
			{
				Assert.AreNotEqual(-1, entry.Value.ToString().IndexOf("data:"));
			}
		}
コード例 #7
0
		void IDeserializationCallback.OnDeserialization(object sender)
		{
			strongReferenceCache = new LRUMap(strongReferenceCount);
		}
コード例 #8
0
		public SoftLimitMRUCache(int strongReferenceCount)
		{
			this.strongReferenceCount = strongReferenceCount;
			strongReferenceCache = new LRUMap(strongReferenceCount);
		}
コード例 #9
0
		public void PutWithSizeLimitOfZero()
		{
			IDictionary cache = new LRUMap(0);

			cache.Add("key", "data");

			string data = (string)cache["key"];
			Assert.IsNull(data, "Data is wrong.");
		}
コード例 #10
0
 void IDeserializationCallback.OnDeserialization(object sender)
 {
     strongReferenceCache = new LRUMap(strongReferenceCount);
 }
コード例 #11
0
 public SoftLimitMRUCache(int strongReferenceCount)
 {
     this.strongReferenceCount = strongReferenceCount;
     strongReferenceCache      = new LRUMap(strongReferenceCount);
 }
コード例 #12
0
		public SimpleMRUCache(int strongReferenceCount)
		{
			this.strongReferenceCount = strongReferenceCount;
			cache = new LRUMap(strongReferenceCount);
		}
コード例 #13
0
 public SimpleMRUCache(int strongReferenceCount)
 {
     this.strongReferenceCount = strongReferenceCount;
     cache = new LRUMap(strongReferenceCount);
 }