InMemory token cache vs distributed token cache

Newbie Dev 156 Reputation points
2022-01-13T16:19:21.563+00:00

Hi,
I am working on a .netcore 3.1 API project. This project uses On Behalf of flow to get the user profile using Graph API.

For development purpose I was using InMemory token caching which worked fine.

But I can see on the msdn site they do recommend Distributed Token Cache.

Does it really matter for an API project which caching I use? The only token cache it uses would be to save the access_token to call the Graph API.

I read the benefit of Distributed Token Cache is it retains the cache after an app restart?

If the traffic is really high on the API would it be wise to use the Distributed Token Cache? Or would InMemory be ok?

Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AgaveJoe 30,126 Reputation points
    2022-01-13T18:26:35.697+00:00

    Distributed cache is a central dedicated server that persists cache. Distributed cache is good when you have a load balanced environment or as you pointed out persisting cache when the application restarts. Ultimately, it depends on your needs which is not evident from the description.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.