I use the new System.Runtime.Caching library for caching in my application and define it as follows in App.config:
<system.runtime.caching>
<memoryCache>
<namedCaches>
<add name="MyCache" cacheMemoryLimitMegabytes="10"
physicalMemoryLimitPercentage="30" pollingInterval="00:00:10" />
</namedCaches>
</memoryCache>
</system.runtime.caching>
Then from the code I create it as follows: _cache = new MemoryCache("MyCache");
And add these lines: _cache.Add(resourceName, resource, new CacheItemPolicy());
I use this cache to store objects BitmapImage, and to make sure the cache works correctly, I added ten objects to the cache BitmapImage, each of which has an image of about 7 MB in size. Then I waited ten seconds for the survey to take place, and checked the cache entries, but they were all there. Not a single object was evicted.
- ? , App.config . , BitmapImage ? ?