Caching in HTTP
HTTP is typically used for distributed information systems, where performance can be enhanced by using cached feedback. The HTTP / 1.1 protocol includes several elements that are intended to perform caching tasks.
The goal of saving to hidden memory in HTTP / 1.1 is to calculate the need to send requests in many cases, and to calculate the need to send full responses in many other cases.
The basic caching technique in HTTP / 1.1 is to include instructions to cache memory where the Server determines the time and expiration date. We use the Cache-Control field for this purpose.
The Cache-Control field allows a Client or Server to transmit various directives in either requests or responses. These directives are characterized by having higher priority than caching algorithms by default. Indicators stored in hidden memory are defined in a list separated by commas. For example:
Cache-control: no-cache
The following are directives for caching requests that can be used by the Client in its HTTP request:
Instructions for hidden memory description No-cache descriptionA hidden memory must not use the response to satisfy a subsequent request without re-confirming success with the original Server.
no-storeThe cache should not store anything about the Client request or the Server counter.
max-age = (in seconds)Indicates that the Client wants to accept a response whose time is not greater than the time specified in seconds (s).
max-stale [= seconds]Indicates that the Client is willing to accept a response that has exceeded the expiration time. If the number of seconds is provided, it must not be expired by more than that time.
min-fresh = secondsIndicates that the Client is willing to accept a response whose health life is no less than its current age plus the specified time in seconds.
no-transformDo not convert the body of the object.
only-if-cachedDo not get new data. Hidden memory can send a document only if it is in hidden memory, and should not contact the original Server to consider if a newer copy exists.
The following caching response directives can be used by the Server in its HTTP response:
Hide memory feedback instructions Public descriptionIndicates that feedback can be kept in memory hidden by any hidden memory.
privateIndicates that all or part of the response message is considered as for a single user and must not be kept in hidden memory by a shared cache.
no-cacheA hidden memory must not use feedback to satisfy a subsequent request without re-confirming success with the original Server.
no-storeCaching should not save anything about Client requests or Server responses.
no-transformDo not convert the body of the object.
must-revalidateThe cache must verify the status of old documents before using it and expired documents should not be used.
proxy-revalidateThe instruction to re-authorize authorization has the same meaning as the must-revalidate directive, except it does not apply to hidden user agent memory that is not shared.
max-age = secondsIndicates that the client is willing to accept a request whose age is not greater than the specified time in seconds.
s-maxage = secondsThe maximum age defined by this directive exceeds the maximum age specified by either the max-age directive or Expires Header. The s-maxage instruction is always ignored by an individual memory.
According to Tutorialspoint
Previous article: Header fields in HTTP
Next lesson: URL encoding in HTTP
You should read it
May be interested
- 5 ways to improve website speed with HTTP / 2hypertext transfer protocol version 2 (hypertext transfer protocol version 2) or http / 2 is the latest http standard. updates to this protocol will improve the speed, performance and security of web traffic.
- Encrypt status in HTTPthe status-code element is a 3-character integer, in which the first character of the status encoding defines the response type and the last two characters do not have any sorting role. there are 5 values of the first character.
- Full list of HTTP status codes, HTTP Status Codethe http status line is the term given to the http status code (real code) when accompanied by the 'http reason phrase' - the term for the reason (short description).
- MQTT and HTTP: Which protocol is better in the IoT era?the hypertext transfer protocol (http) has always been the most popular communication tool between client and web server. but is it still suitable for the internet of things era?
- Example of Message in HTTPsome examples of message in http make it easier for users to visualize.
- Learn about caching, a popular technique to increase computer performance?in this article, i would like to introduce you to caching, a very popular technique to increase computer performance. this is a 2-part series of articles, part 1 will explain the basic principles of cache, and common ways to apply cache in practice. part 2, i will explain the cpu
- What is HTTP Authentication? 5 Stages of HTTP Authenticationhttp authentication is a security mechanism that helps verify the identity of users when they access web resources.
- How to Execute HTTP POST Requests in Androidhttp post is part of a deprecated http classes like org.apache.http and androidhttpclient as of android 5.1.https://developer.android.com/about/versions/android-5.1.html#http migrate your code to the httpurlconnection classes which...
- How to use Fiddler to collect HTTP / HTTPS sessions for debuggingfiddler is a free web debugging proxy that records all http / https traffic between your web application and the internet. collecting session data with fiddler can be useful for troubleshooting situations
- What's the difference between HTTP and HTTPS?you probably already know https as an enhanced form of http . however, do you already know the difference between http and https ? if not, let's find out with tipsmake.com!