![]() NET Framework.Īfter creating some unit tests for the cache, I quickly discover some inconsistencies. My expectation is that the Memor圜ache in ASP.NET Core behaves the same way as Memor圜ache in the. NET Framework is thread-safe ( according to the documentation). GetOrCreate does return the newly cached value, so that seems like a more useful approach, and the reasoning for the name change. NET Framework (full framework).Īlso, the AddOrGetExisting method doesn't return the value if the key doesn't exist in cache. Intuitively, my first guess is that it replaces the AddOrGetExisting method from Memor圜ache in the. I must admit that I don't have a lot of experience with ASP.NET Core on customer projects, so the first thing that strikes me is that the Memor圜ache method GetOrCreate/ GetOrCreateAsync is new. ![]() ![]() It's recommended over, and works natively with ASP.NET Core dependency injection, according to the documentation. In my current work project I'm building an API using ASP.NET Core 2.2.Īdding Memor圜ache to an ASP.NET Core app is easy, just add the nuget. This blog post also contains an interview with the creator of Laz圜ache. In this blog post I will be researching a common question raised on forums like StackOverflow: "Is the GetOrCreate method thread safe?". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |