In the first article of the series, we talked about the basic concepts of HTTP. Now that we have a foundation to build upon, we can talk about some of the architectural aspects of HTTP. There is more to HTTP than just sending and receiving data.
HTTP cannot function by itself as an application protocol. It needs infrastructure in the form of hardware and software solutions that provide different services and make communication over the World Wide Web possible and efficient.
Try to remember something that happened on your last vacation. How long did it take you to recall? Now, try to remember it again. You were probably able to recall it faster the second time— but, why? This is because as soon as you recalled the event the first time, your brain saved the information to your recent memory.
The same concept applies to caching. Caching is a way of temporarily storing the contents of a webpage in locations near the user, similar to the way our memory works. There are several types of caching options available like database caching, application caching, distributed caching, etc. In this article, we’ll talk about web caching and how it affects user experience.
Here’s an interesting problem for you: build some simple caching.
Let’s say you have a server and an app. Your server has to do something every time you release a new app. Asking for reviews is a good example. If you automate this, everyone will be happier.
Where is the output cache in ASP.NET Core? Is it gone? No, it’s there but in new and better extensible form, and it is called now response caching. This blog post shows how to use response caching on ASP.NET Core and provides tips about some of the internals of it.
In ASP.NET Core caching is solved as a middleware service that comes with Microsoft.AspNetCore.ResponseCaching NuGet package. In MVC, caching is driven by the ResponseCache attribute. It’s possible to use the ResponseCache attribute without also response caching the middleware to just set response headers. This way, it is possible to tell the browser to cache content, and also cache or proxy servers on the way that can read these headers to find out how to cache page.