DEV Community

Cover image for Caching in ASP.NET Core πŸ₯‡
Hussein Mahdi
Hussein Mahdi

Posted on

Caching in ASP.NET Core πŸ₯‡

Caching is used to temporarily store data 🧱 that is expensive to generate or retrieve. This can significantly improve 🎯the performance of your application πŸ› by reducing the time it takes to generate responses and decreasing the load on your database or other data sources βš™.

🎯 The completed lesson provides a simplified ✨ and concise explanation of storing data in In-Memory Cache (IMemoryCache) within ASP.NET Core. This caching mechanism improves application performance by storing frequently accessed data in memory βœ”. It emphasizes the importance of creating dedicated cache instances to maintain control over cache entries and sizes. By following these guidelines πŸ•Έ, developers can effectively utilize caching while optimizing application performance and stability.

type chaching

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Warning
Using IMemoryCache with SetSize, Size, or SizeLimit can cause app failures if the cache is shared. Every cache entry must specify a size when limits are set, which isn't always feasible in shared environments. To avoid issues, create a dedicated cache instance for your application. Always set sizes for cache entries and monitor memory usage to ensure optimal performance and stability.

more details of warning : Microsoft Aspnet Core Performance Caching

more details :

Top comments (0)