简体   繁体   中英

Cache an object for two subdomains in asp.net

We have just added a few more sub domains to our organisation's website. One sub domain is now dedicated for admin things like editing pages and content, another one now handles the gallery and the main one is just responsible for displaying the normal website. All in their own respective app pool.

The problem is that, on the normal webpage, we have a lot of pages that load their content from the database. This is fine in most cases but is starting to become a problem. My idea is to cache the content that is to be displayed on the webpages to avoid having it load from the database all the time. The problem is that if i create a cache on the webpage it's not shared with the other sub domains.

What would be a good way to resolve this and have a cache that is shared between all our sub domains? Create some sort of WCF/Console-project that is running in the background serving the cache? Create a Windows Service?

Since we are an organisation we don't have that much money to go around with and so buying an expensive solution is not possible.

I think you could use Redis cache http://redis.io/ as your caching solution. It can be run on the same server (or a dedicated one) and it is fast enough for most practical use cases.

All of your webapps can share the same instance of Redis cache and using a product already being used by a larger community is definitely better than reinventing your own cache unless you have a very specific need an existing solution can't fulfil.

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