locked
memory cache RRS feed

  • Question

  • I am using the memory cache reserve data in memory about 120 GB I know its too large but its the best practice for my project the issue is I am using the memory cache object as the following 

    I created static object for the cache memory

    var collection = new System.Collections.Specialized.NameValueCollection();
                collection.Add("CacheMemoryLimitMegaBytes", "155000");
                //var memoryCashe = new MemoryCache("Images", collection);
                MemoryCachingProvider.cache = new MemoryCache("Images", collection);

    //Here how I add new item

    CacheItemPolicy policy = new CacheItemPolicy();
                        policy.Priority = CacheItemPriority.NotRemovable;
                        cache.Add(key, value, policy);

    but the memory became empty after period of time if I didn't use it.

    I am building web API application 

    and I have enough space in the RAM about 170 GB

    any suggestions

    Monday, September 25, 2017 2:14 PM

All replies

  • Hi hussam taani,

    Thank you for posting here.

    According to your question is more related to web API, you could post a new thread in Web API forum for suitable support.

    This forum discuss and ask the C# programming language, IDE, libraries, samples and tools. If you have some grammar or code errors, please feel free to contact us. We will try our best ti give you a solution.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 2, 2017 5:22 AM