How to make your API faster in ASP.NET 8 | HOW TO – Code Samples



How to make your API faster in ASP.NET 8 | HOW TO – Code Samples

How to make your API faster in ASP.NET 8 | HOW TO - Code Samples

https://StartupHakk.com/?v=8JS44dxTPfk

#coding #codingbootcamp #softwaredeveloper #CodeYourFuture

GitHub Repo: https://github.com/slthomason/StartupHakk/blob/main/78_Make_API_Faster_In_ASPDotNet/Program.cs

Since the release of .NET Core in 2016 as an open-source framework, contributors were always delivering new features requested by the communities, and to be honest, they didn’t disappoint, and as .NET 8 is coming soon this November, it is coming packed with a fair number of features, one of the best features we are getting is having the ability to use distributed caching using just one line of code, well not exactly one line, but it removed a lot of the hurdles that were needed to be able to use distributed caching like Redis, and this is what we are going to discover in this video.

A simple test to begin with
Let’s start by creating a new ASP.NET Web API project using minimal API, you can also use Controllers, but let’s stick with minimal API for the sake of simplicity, then we will use Json placeholder API as an external API to be able to see the difference in the request time.

Now how can we implement distributed caching?
ASP.NET 8 now gives us a very straightforward way to implement distributed cache using Redis for our API

As you can see, we have reduced the response time all the way down to 1.6ms, and that’s because of caching, by the way, I’m using Insomnia to test my API, this is one way for making your API faster, another feature that is coming with ASP.NET is native Ahead-of-Time (AOT) compilation, it makes your application size smaller, and uses less memory and have faster startup time.

Lots of Great How Tos and Code Samples! Make sure to like and subscribe!