I have tried refresh action before this post.
There is a multi-thread sync problem, when the refresh action is running, the cache item is not in the cache, and this happens every 5 minutes, so there is a prety high chance that GetData will return a null as I already encountered. I don't know what to
lock and when to put the lock to solve the problem. Add an item with the same key might cause the same problem. Any suggestions on this?
If the sync problem can't be solved, I will try to implement my own ICacheItemExpiration as you suggested.
If the two approaches don't work with my scenario, I will be forced to add a pre-remove event in the cache app block as the last work around.
Did you mean that when I add an item whose key already exists in cache, the pre-remove event will also be triggered?
Would you please tell me anything else I should pay attention to when doing this?