'How to remove all objects (reset) from IMemoryCache in ASP.NET Core on every app restart?

I want to reset both IMemoryCache and RedisCache implementation (ICacheProvider) on every app startup event in asp.net core 3.1 web api application.

Can anyone help me with their guidance to fix this issue



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source