c# - MemoryCache Aspnet MVC -


i've problem implement memorycache object in aspnet. code

        objectcache cache = memorycache.default;         cacheitempolicy policy = new cacheitempolicy();         policy.absoluteexpiration = datetimeoffset.now.addseconds(10.0);         cache.add("keyname", resultquery, policy); 

the object correct insert in cache when delete , rewrite new object in view visible in session.

        var q = queryobject;         var cachekey = "keyname";         memorycache.default.remove(cachekey);         objectcache cache = memorycache.default;         cacheitempolicy policy = new cacheitempolicy();         policy.absoluteexpiration = datetimeoffset.now.addseconds(10.0);         cache.add(cachekey, q, policy); 

and simple implementation.

        cache.get(cachekey); 

i don't understand why works in different browser session , doesn't work. can me? thanks.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -