How to handle BL cache for multiple web applications?

I recently got a project that contains several web applications without an MVC framework. To start, I created a library (DLL) that will contain the core business logic. The problem is caching. If I use the current web context cache object, I can complete the duplication of caching (since the context will be different for each application).

I'm currently thinking of introducing a simple caching mechanism with a singleton template that will allow different websites (aka different application domains) to share their "caching wisdom."

I would like to know how to best solve this problem.

EDIT: I use only one server (with multiple applications).

+4
source share
4 answers

I was also suggested to use SharedCache , which look exactly the same as the architecture I'm looking for: Single instance caching .

0
source

Depending on the type and size of the data you want to cache, I suggest:

  • For small amounts of primitive data: nCacheD (codeplex) - memcached redux for .net
  • For heavy objects: MS caching and practice unit (msdn)

In general, although I would look at my requirements and make sure that I really need an all-inclusive cache, writing code to maintain my state (and adjust its resource consumption) will not be more expensive than going directly to the database. If most of the things you want to cache are static pages or a combination of static and dynamic content, I would consider using the IIS / ASP.NET page level cache.

+1
source

I have two different suggestions depending on your scaling plans. Regardless of which cache you choose, I would suggest that you first implement an adapter template that abstracts you from your cache, as a result of which it will limit your cache dependency and allow you to change it later.

If you want to scale down by adding a web farm (more than one application server), look at speed. Microsoft will pack this in 4.0, but now it is CPT3 and very easy to use.

Documentation

Download

If you do not plan to upgrade to a system with multiple servers, just use HttpContext.Current.Cache

+1
source

It sounds like you should take a look at Create more efficient distributed caching applications . This article describes the new distributed cache from Microsoft (codenamed Velocity).

0
source

Source: https://habr.com/ru/post/1305146/


All Articles