Caching's Mechanism
The most important question: How does the "cache" know if it has a saved response for a specific request? Well, there are many key factors to answer this question. For example, "expiry time" if the time is expired the caching server will fetch the response from the webserver and cache it. Another factor is the concept of Caching "keys". For example, Host in HTTP Header and URL path is usually considered as "cache key". There is another important concept which is "unkeyed inputs". These inputs are used on the pages, however, it is not considered as "cache keys".
For example:
First Request