You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following example we will construct our client using the builder provided by [`reqwest_middleware`](https://github.com/TrueLayer/reqwest-middleware) with our cache struct from [`http-cache-reqwest`](https://github.com/06chaynes/http-cache/tree/latest/http-cache-reqwest). This example will use the default mode, default cacache manager, and default http cache options.
22
+
In the following example we will construct our client using the builder provided by [`reqwest_middleware`](https://github.com/TrueLayer/reqwest-middleware) with our cache struct from [`http-cache-reqwest`](https://github.com/06chaynes/http-cache/tree/main/http-cache-reqwest). This example will use the default mode, default cacache manager, and default http cache options.
20
23
21
24
After constructing our client, we will make a request to the [MDN Caching Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching) which should result in an object stored in cache on disk.
Copy file name to clipboardExpand all lines: docs/src/clients/surf.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,11 @@ cargo add http-cache-surf
12
12
13
13
-`manager-cacache`: (default) Enables the [`CACacheManager`](https://docs.rs/http-cache/latest/http_cache/struct.CACacheManager.html) backend cache manager.
14
14
-`manager-moka`: Enables the [`MokaManager`](https://docs.rs/http-cache/latest/http_cache/struct.MokaManager.html) backend cache manager.
15
+
-`manager-foyer`: Enables the [`FoyerManager`](https://docs.rs/http-cache/latest/http_cache/struct.FoyerManager.html) backend cache manager.
15
16
16
17
## Usage
17
18
18
-
In the following example we will construct our client with our cache struct from [`http-cache-surf`](https://github.com/06chaynes/http-cache/tree/latest/http-cache-surf). This example will use the default mode, default cacache manager, and default http cache options.
19
+
In the following example we will construct our client with our cache struct from [`http-cache-surf`](https://github.com/06chaynes/http-cache/tree/main/http-cache-surf). This example will use the default mode, default cacache manager, and default http cache options.
19
20
20
21
After constructing our client, we will make a request to the [MDN Caching Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching) which should result in an object stored in cache on disk.
21
22
@@ -24,16 +25,17 @@ use http_cache_surf::{Cache, CacheMode, CACacheManager, HttpCache, HttpCacheOpti
Copy file name to clipboardExpand all lines: docs/src/development/supporting-a-backend-cache-manager.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,9 @@ pub struct CacheMetadata {
102
102
}
103
103
```
104
104
105
-
This struct derives [serde](https://github.com/serde-rs/serde) Deserialize and Serialize to ease the serialization and deserialization with JSON for the streaming metadata, and [bincode](https://github.com/bincode-org/bincode) for the traditional Store struct.
105
+
This struct derives [serde](https://github.com/serde-rs/serde) Deserialize and Serialize to ease the serialization and deserialization with JSON for the streaming metadata, and [postcard](https://github.com/jamesmunns/postcard) for the traditional Store struct.
106
+
107
+
**Important:** The `bincode` serialization format has been deprecated due to RUSTSEC-2025-0141 (bincode is unmaintained). New implementations should use `postcard` instead. The library still supports bincode through legacy feature flags (`manager-cacache-bincode`, `manager-moka-bincode`) for backward compatibility, but these will be removed in the next major version.
106
108
107
109
### Part Two: Implementing the traditional `CacheManager` trait
108
110
@@ -126,7 +128,7 @@ impl CacheManager for CACacheManager {
Copy file name to clipboardExpand all lines: docs/src/development/supporting-an-http-client.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ The [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware
12
12
-`policy`: returns a [`CachePolicy`](https://docs.rs/http-cache-semantics/latest/http_cache_semantics/struct.CachePolicy.html) with default options for the given `HttpResponse`
13
13
-`policy_with_options`: returns a [`CachePolicy`](https://docs.rs/http-cache-semantics/latest/http_cache_semantics/struct.CachePolicy.html) with the provided [`CacheOptions`](https://docs.rs/http-cache-semantics/latest/http_cache_semantics/struct.CacheOptions.html) for the given `HttpResponse`
14
14
-`update_headers`: updates the request headers with the provided [`http::request::Parts`](https://docs.rs/http/latest/http/request/struct.Parts.html)
15
-
-`force_no_cache`: overrides the `Cache-Control` header to 'no-cache' derective
15
+
-`force_no_cache`: overrides the `Cache-Control` header to 'no-cache' directive
16
16
-`parts`: returns the [`http::request::Parts`](https://docs.rs/http/latest/http/request/struct.Parts.html) from the request
17
17
-`url`: returns the requested [`Url`](https://docs.rs/url/latest/url/struct.Url.html)
18
18
-`method`: returns the method of the request as a `String`
@@ -36,7 +36,7 @@ The `update_headers` method is used to update the request headers with the provi
36
36
37
37
### The `force_no_cache` method
38
38
39
-
The `force_no_cache` method is used to override the `Cache-Control` header to 'no-cache' derective. This is used to allow caching but force revalidation before resuse.
39
+
The `force_no_cache` method is used to override the `Cache-Control` header to 'no-cache' directive. This is used to allow caching but force revalidation before reuse.
The `force_no_cache` method is used to override the `Cache-Control` header in the request to 'no-cache' derective. This is used to allow caching but force revalidation before resuse.
138
+
The `force_no_cache` method is used to override the `Cache-Control` header in the request to 'no-cache' directive. This is used to allow caching but force revalidation before reuse.
You can attempt to retrieve a record from the cache using the `get` method. This method accepts a `&str` as the cache key and returns an `Result<Option<(HttpResponse, CachePolicy)>, BoxError>`.
0 commit comments