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
- Security in HTTP
- What is HTTP
- Request (HTTP) in HTTP
- Chrome will support HTTP cache partitioning to prevent malicious attacks and unauthorized tracking
- What is HTTP Flood?
- Things you should know about HTTP / 2 protocol
- Parameters in HTTP
- Message in HTTP
- How HTTP works
- Response (Response) in HTTP
- 5 ways to improve website speed with HTTP / 2
- Encrypt status in HTTP
Maybe you are interested
How does stress damage memory and cause anxiety disorders?
The world's 'stupid' bird, at the moment of life and death it 'loses its memory'
Nvidia launches RTX 4070 version with 'super fast' GDDR6 memory
Nvidia is developing a line of AI GPUs with 144GB HBM3E memory
3 Ways to free up Google Drive space, increase memory
Samsung begins mass production of 'most advanced' 12nm DDR5 memory chips