0
votes

Background

In my project app, many small applications has been integrated and they have built-in different technologies such as

  • Angular JS 1.5
  • ASP.Net MVC
  • Angular 5

My app also uses AWS as cloud partner.

Problem

I need to implement Caching mechanism in my app. I am storing some values in S3 bucket and I am using API calls to pull the values. I want to keep those values in Cache. Since, it is implemented in multiple technologies (especially Angular and ASP.Net MVC), Does any caching mechanism can be used in common?

Observations

I have done some work on this and observed the following caching is available

  1. .NET MVC - In Memory Caching
  2. Angular - In Memory Cache with ReactJS

As AWS is my Cloud Partner, it is offering ElastiCache as a Web service, which supports MemCached and Redis. I am not clear whether this will behave like normal In-Memory Cache ( in ASP .NET Core) or this will refer database for caching and retrieve details (cause round-trip!) from there?

Question

Can anyone let me know best caching technique can be handled to my app for both .net mvc and angular?

1

1 Answers

1
votes

This is bit tricky (I am assuming that you are using multiple servers of memcache). When you use memcache a lot depends on the clients implementation. Your client decides, on which server a particular key will be stored. And the servers are unaware of the existences of the other servers.

As you are using different languages you will be using different clients so each client will be implementing its own algorithm to decide the server on which the key will be placed. So there will be cases where your client on Angular will store key "K1" on server "S1" and the .Net Client will store the same key on server "S2"

This will add another problem of invalidating these keys, as it will be needed to invalidate the key on both servers.

There is one more problem. You will have to store all objects in a json format if the keys are common. So that the keys is stored on the same memcache server will be read by all programing languages.

I think the best thing is to set a small enough time to invalidate keys on memcache (if it is feasible) and storing keys with different prefix or suffix for each client type. So .net client will store key K1 as 'K1-net' and the one with Angular will store it as "k1-ang".

I would also explore redis which might help (not sure)