简体   繁体   中英

Why my httpcontext.cache works in localhost not production?

I am using HttpContext.Cache.Insert to cache my data but it only works in my localhost.

In production, the cache just worked when I refreshed the same page, once I clicked to next page, my previous cache gone. Would this because of the production server web farm issue? Which it does not able to sync the cache data.

If you're deploying to a farm you'll want a distributed cache, eg memcached . The built-in ASP.NET cache works in-process, without any syncing to other instances.

使用HttpContext.Cache缓存的范围是应用程序域级别,因此,如果您在Web场中运行,则可能会发生这种行为。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM