예제 #1
0
    static void Main(string[] args)
    {
        var cache  = new LRUCache(2);
        var images = new List <Image>()
        {
            new Image {
                Name = "foo", Value = "fooval"
            },
            new Image {
                Name = "bar", Value = "barval"
            },
            new Image {
                Name = "qux", Value = "quxval"
            },
        };

        foreach (var image in images)
        {
            var lookup = cache.GetImage(image.Name);
            Console.WriteLine(lookup);
            cache.SetImage(image.Name, image);
            lookup = cache.GetImage(image.Name);
            Console.WriteLine(lookup);
        }

        //Console.WriteLine(cache.Count());
        //Console.WriteLine(cache.CacheCount());
        cache.Print();
    }