Skip to main content
Filter by
Sorted by
Tagged with
127 votes
13 answers
146k views

I have created a cache using the MemoryCache class. I add some items to it but when I need to reload the cache I want to clear it first. What is the quickest way to do this? Should I loop through all ...
Retrocoder's user avatar
  • 4,753
31 votes
2 answers
19k views

I have set cache items with sliding expiration in a Microsoft.Extensions.Caching.Memory.MemoryCache. I want to trigger a callback everytime a cache item expires, but callback isn't triggered until I ...
mattinsalto's user avatar
  • 2,426
45 votes
7 answers
33k views

Cache is controlled by cache hardware transparently to processor, so if we use volatile variables in C program, how is it guaranteed that my program reads data each time from the actual memory address ...
Microkernel's user avatar
  • 1,437
77 votes
3 answers
35k views

I'd like to add caching capabilities to my application using the System.Runtime.Caching namespace, and would probably want to use caching in several places and in different contexts. To do so, I want ...
Adi Lester's user avatar
  • 25.4k
47 votes
4 answers
49k views

I'm trying to use a MemoryCache in .net 4.5 to keep track of and automatically update various items, but it seems like no matter what I set as an AbsoluteExpiration it will always only expire in 15 ...
Jared's user avatar
  • 1,220
6 votes
1 answer
8k views

I read post C volatile variables and Cache Memory But i am confused. Question: whether OS will take care itself OR programmer has to write program in such a way that variable should not ...
Embedded Programmer's user avatar
58 votes
2 answers
43k views

I'm using MemoryCache in ASP.NET and it is working well. I have an object that is cached for an hour to prevent fresh pulls of data from the repository. I can see the caching working in debug, but ...
atconway's user avatar
  • 21.3k
32 votes
1 answer
8k views

Where are .NET 4.0 MemoryCache performance counters? I am looking for their name and I can't find any. Thank you,
Allan Xu's user avatar
  • 9,604
7 votes
3 answers
4k views

The app needs to load data and cache it for a period of time. I would expect that if multiple parts of the app want to access the same cache key at the same time, the cache should be smart enough to ...
Christian Findlay's user avatar
40 votes
2 answers
29k views

In a controller class, I have using Microsoft.Extensions.Caching.Memory; private IMemoryCache _cache; private readonly MemoryCacheEntryOptions CacheEntryOptions = new MemoryCacheEntryOptions() ....
Thorkil Værge's user avatar
13 votes
3 answers
15k views

In ASP.NET Core its very easy to access your memory cache from a controller In your startup you add: public void ConfigureServices(IServiceCollection services) { services....
SpeedBird527's user avatar
6 votes
1 answer
12k views

I was looking for Caching in my web api where i can use output of one api method(that changes once in 12hrs) for subsequesnt calls and then i found this solution on SO,but i am having a difficulty in ...
F11's user avatar
  • 3,826
5 votes
3 answers
7k views

I have a ListView which contains a large set of data. At the first time, I load all the data from a Webservice. Now I want to cache that data so that, if I'm to open that page again, I can fetch ...
jithu's user avatar
  • 706
4 votes
2 answers
5k views

The new class MemoryCache in .Net 4.0 appears to act just like asp.net caching. My questions are: Is MemoryCache equivalent to storing an object/value in for a user in Session Cache, but not in the ...
Jason's user avatar
  • 551
36 votes
4 answers
92k views

I am trying to write a class to handle Memory cache in a .net core class library. If I use not the core then I could write using System.Runtime.Caching; using System.Collections.Concurrent; ...
MJK's user avatar
  • 3,504
15 votes
1 answer
12k views

I'm using a .net Memory Cache with .NET 4.0 and c#, I want my application to be notified when an item is removed (so I can write that it has been removed to a log file or notify the UI, that the item ...
DermFrench's user avatar
  • 4,035
10 votes
4 answers
24k views

How to correctly clear IMemoryCache from ASP.NET Core? I believe this class is missing Clear method, but anyway how to deal with it? In my project I'm caching DocumentRepository's methods for 24 ...
CSharpBeginner's user avatar
8 votes
1 answer
5k views

As said in EhCache documentation: In practice this means that persistent in-memory cache will start up with all of its elements on disk. [...] So, the Ehcache design does not load them all into ...
Matthieu Napoli's user avatar
7 votes
1 answer
1k views

System.Runtime.Caching.MemoryCache is a class in the .NET Framework (version 4+) that caches objects in-memory, using strings as keys. More than System.Collections.Generic.Dictionary<string, ...
Joe Amenta's user avatar
  • 5,341
5 votes
2 answers
3k views

I am using MemoryCache from System.Runtime.Caching of .NET 4 and I wish to invalidate the cache entry when a directory changes. HostFileChangeMonitor is supposed to handle both files and directories ...
ador-mg's user avatar
  • 120
2 votes
0 answers
1k views

I have implemented a cache that renews the containing values when they expire. My code is this: class MyCache { private static readonly MemoryCache Cache = MemoryCache.Default; private ...
Jesper Lund Stocholm's user avatar
1 vote
1 answer
3k views

I have a project with asp.net core and entity framework core, for performance reasons I use MemoryCache. ForumQueryManager class is for querying forum data. This class for data uses the CacheManager ...
Mohammad Akbari's user avatar
0 votes
0 answers
416 views

I'm developing Image Loader using both cache. and here is my logic. 1st, start get the images on the disk cache (when app starting) 2nd, check the memory cache. if it is, load from Cache memory. ...
Adrian's user avatar
  • 301
0 votes
3 answers
2k views

I am building a online shop website. I want to display ProductCategory as a Sidebar (short list categories, Eg Clothes, Electronics, Furniture, Books, etc). At the end, I want to send around ...
user avatar