---
title: "Discussion on \"⚠️ Warning: Don't cache lazy IEnumerable<T> in .NET\" | Hashnode"
description: "Discussion on \"⚠️ Warning: Don't cache lazy IEnumerable<T> in .NET\". (The same is true for IAsyncEnumerable<T>)\nA few days ago I came across a code where a developer used .NET MemoryCache to cache data retrieved from the database. Sounds boring, but... every time the cache needed to return a result, a call to the data..."
url: "https://hashnode.com/posts/warning-dont-cache-lazy-ienumerablet-in-net/63e684e3defa5906e19140b6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [⚠️ Warning: Don't cache lazy IEnumerable<T> in .NET](https://zagosk.in/warning-dont-cache-lazy-ienumerablet-in-net?utm_source=hashnode&utm_medium=feed)

(The same is true for IAsyncEnumerable<T>) A few days ago I came across a code where a developer used .NET MemoryCache to cache data retrieved from the database. Sounds boring, but... every time the cache needed to return a result, a call to the data...

Feb 10, 2023 · 2 min read · zagosk.in  
Read the article

-   [#dotnet](https://hashnode.com/tag/dotnet)
-   [#csharp](https://hashnode.com/tag/csharp)
-   [#caching](https://hashnode.com/tag/caching)

## Written by

[Aleksei Zagoskin](https://hashnode.com/@azagoskin)

@azagoskin · The Netherlands 🇳🇱

  
[View profile](https://hashnode.com/@azagoskin)

Software Architect, Staff Engineer

Software Architect, Staff Engineer | .NET, C#, microservices | Design and create scalable, high-load, fault tolerant and distributed backend services and Web APIs 👨🏼‍💻

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
