public void Ctor_01() { Assert.DoesNotThrow(() => { cache = new LruCache <int, int>(0); cache.Insert(0, 0); Assert.IsFalse(cache.HasKey(0)); }); }
private static void AddCacheEntries(ILruCache <dynamic, dynamic> lruCache, int numAdditions) { for (var i = 0; i < numAdditions; i++) { var ticks = DateTime.Now.Ticks; var key = $"key{ticks}"; var value = $"value{ticks}"; lruCache.Add(key, value); } }
public override void Init() { App.On(ApplicationEvents.ON_APPLICATION_START_COMPLETE, (sender, e) => { ILruBuilder builder = App.Make <ILruBuilder>(); ILruCache <string, string> cache = builder.Create <string, string>(3); cache.Add("key_1", "val_1"); cache.Add("key_2", "val_2"); cache.Add("key_3", "val_3"); foreach (var kv in cache) { Debug.Log(kv.Key + " , " + kv.Value); } var key = cache["key_2"]; Debug.Log("key is :" + key); Debug.Log("*******************"); foreach (var kv in cache) { Debug.Log(kv.Key + " , " + kv.Value); } cache.Add("key_4", "key_4"); Debug.Log("*******************"); foreach (var kv in cache) { Debug.Log(kv.Key + " , " + kv.Value); } }); }
public void Setup() { cache = new LruCache <int, int>(capacity); }
public void Setup() { _lruCache = new LruCache <dynamic, dynamic>(_maxSize); }