So, I have an interesting problem. We are using AppFabric and caching a bunch of data off to it. Have some aspects that will store into cache and a method to clear the cache of specific keys when called. However I'm experiencing a weird issue where I am having a "phantom" cache.
So here is the creation scenario.
2 browsers, (firefox and chrome), 1 has admin up, the second a regular user.
- wait till the cache expires (5 minutes) then check the cache to make sure its clear. It is.
- Next refresh the regular user to insert into cache, verify that its there with admin. It is.
- update a user with the admin (clear cache during update) verify its been cleared. It is.
- Refresh the regular user browser and see if it changed. It doesn't
This last is the issue. I've cleared the cache, verified its clear and yet the other browser acts like it didn't clear it. This doesn't always happen but often enough that I'm pulling my hair out trying to solve it.
Does anyone have any thoughts on what this could be?
Update of general cacheing pattern. Sorry I can't share specifics.
- PostSharp Attribute to intercept method calls and perform caching.
- Check for httpContext cache
- Check for Azure cache
- Throw into httpContext cache if there
- Run method
- Send to httpContext cache
- queue for end of request push to azure cache using httpcontext cache
- Global Action Filter to transfer queued cache values into azure at end of request.
- if child action return
- Loop through queue and throw new items into azure cache
- Clear httpcontext cache of items in queue
What this provides is a ready access way to get cached items only 1 time per request as well as letting any azure puts happen at the end of the request after they have been collected throughout the processing of the request.