From 7bb7a49401a3e8eeb9d747be0a884cc701525206 Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Thu, 23 May 2024 09:49:45 +0200 Subject: [PATCH 1/4] Document Cache-Control --- advanced/fiori.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/advanced/fiori.md b/advanced/fiori.md index 548ee7d5b..66c20d765 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -646,6 +646,15 @@ If you have the need for a more complex calculation, then the interesting parts ::: +## Cache Control + +To indicate that caches can store the response and reuse it for subsequent requests, CAP provides the option to set a `Cache-Control: max-age=` HTTP header. This can be done via `@http.CacheControl: {maxAge: }` CDS annotation on stream properties. The header allows to control the behavior of caches, the `max-age` (in seconds) specifies the maximum age of the content before it becomes stale. + +:::info Note +The `max-age` is the elapsed time since the response was generated on the origin server (not the elapsed time since the response was received). +::: + +
From e1ad3bc0ed0faefd87a504f3300b1d09b3a8e19a Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Fri, 24 May 2024 09:27:53 +0200 Subject: [PATCH 2/4] Update advanced/fiori.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adrian Görler --- advanced/fiori.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 66c20d765..7cbbc47d8 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -648,7 +648,9 @@ If you have the need for a more complex calculation, then the interesting parts ## Cache Control -To indicate that caches can store the response and reuse it for subsequent requests, CAP provides the option to set a `Cache-Control: max-age=` HTTP header. This can be done via `@http.CacheControl: {maxAge: }` CDS annotation on stream properties. The header allows to control the behavior of caches, the `max-age` (in seconds) specifies the maximum age of the content before it becomes stale. +CAP provides the option to set a [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) header with a [max-age](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-age) directive to indicate that a response remains fresh until _n_ seconds after it was generated . +In the CDS model, this can be done via a `@http.CacheControl: {maxAge: }` annotation on stream properties. The header indicates that caches can store the response and reuse it for subsequent requests while it's fresh. +The `max-age` (in seconds) specifies the maximum age of the content before it becomes stale. :::info Note The `max-age` is the elapsed time since the response was generated on the origin server (not the elapsed time since the response was received). From 8685e96c6019e10f23ece47de9fbfdc8a666c5e4 Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Fri, 24 May 2024 09:42:19 +0200 Subject: [PATCH 3/4] java only --- advanced/fiori.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advanced/fiori.md b/advanced/fiori.md index 7cbbc47d8..020c2f64e 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -656,6 +656,9 @@ The `max-age` (in seconds) specifies the maximum age of the content before it be The `max-age` is the elapsed time since the response was generated on the origin server (not the elapsed time since the response was received). ::: +::: warning Only Java +Cache Control feature is currently supported on the Java runtime only. +:::
From c8e9dd9ffba39db71c40b11898002e6e3b72f877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Fri, 24 May 2024 11:41:42 +0200 Subject: [PATCH 4/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky --- advanced/fiori.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 020c2f64e..ef583dbe7 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -649,11 +649,11 @@ If you have the need for a more complex calculation, then the interesting parts ## Cache Control CAP provides the option to set a [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) header with a [max-age](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-age) directive to indicate that a response remains fresh until _n_ seconds after it was generated . -In the CDS model, this can be done via a `@http.CacheControl: {maxAge: }` annotation on stream properties. The header indicates that caches can store the response and reuse it for subsequent requests while it's fresh. +In the CDS model, this can be done using the `@http.CacheControl: {maxAge: }` annotation on stream properties. The header indicates that caches can store the response and reuse it for subsequent requests while it's fresh. The `max-age` (in seconds) specifies the maximum age of the content before it becomes stale. -:::info Note -The `max-age` is the elapsed time since the response was generated on the origin server (not the elapsed time since the response was received). +:::info Elapsed time since the response was generated +The `max-age` is the elapsed time since the response was generated on the origin server. It's not related to when the response was received. ::: ::: warning Only Java