Skip to Main Content
Designing Evolvable Web APIs with ASP.NET
book

Designing Evolvable Web APIs with ASP.NET

by Glenn Block, Pablo Cibraro, Pedro Felix, Howard Dierking, Darrel Miller
March 2014
Intermediate to advanced content levelIntermediate to advanced
538 pages
13h 19m
English
O'Reilly Media, Inc.
Content preview from Designing Evolvable Web APIs with ASP.NET

Appendix D. Caching in Action

As we’ve seen, there are quite a few moving parts involved with HTTP caching. To illustrate how everything works together, let’s take a look at a common scenario involving two clients, an HTTP cache and the origin server. For the sake of brevity the body and all headers are not shown in the responses.

First, Client A does an initial request, as shown in Figure D-1.

Client A does an initial GET
Figure D-1. Client A does an initial GET
  1. The cache receives the request, and seeing that it is a GET request checks whether it has a cached response. It doesn’t, so the cache forwards it on to the origin server.
  2. The origin server generates a response, including ETag and max-age headers.
  3. The cache receives the response and caches the result using a hash of the request URI and the Accept header value.
  4. The cache then returns the response, including an additional AGE header to inform the client of the age of the representation.
  5. Client A receives the representation and stores the ETag and Expires information.

Fifteen minutes later, Client B makes a request to the same resource, as shown in Figure D-2.

Client B does an initial GET
Figure D-2. Client B does an initial GET
  1. The cache receives the request and checks whether it has a copy of the representation.
  2. It sees from the matching on the URI and Accept that the representation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering ASP.NET Web API

Mastering ASP.NET Web API

Mithun Pattankar, Malendra Hurbuns
Enterprise Application Development with C# 9 and .NET 5

Enterprise Application Development with C# 9 and .NET 5

Ravindra Akella, Rishabh Verma, Arun Kumar Tamirisa, Suneel Kumar Kunani, Bhupesh Guptha Muthiyalu

Publisher Resources

ISBN: 9781449337919Errata Page