@helia/delegated-routing-v1-http-api-client 4.1.2 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -68,6 +68,20 @@ const libp2p = await createLibp2p({
68
68
  await libp2p.peerRouting.findPeer(peerIdFromString('QmFoo'))
69
69
  ```
70
70
 
71
+ ### Caching
72
+
73
+ By default, the client caches successful (200) delegated routing responses in browser environments (that support the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache)) for a duration of 5 minutes. The client does this by adding an `x-cache-expires` header to the response object.
74
+
75
+ If caching is enabled, the client will cache responses for the duration of `cacheTTL` milliseconds.
76
+ If `cacheTTL` is 0, caching is disabled:
77
+
78
+ ## Example
79
+
80
+ ```typescript
81
+ // disable caching
82
+ const client = createDelegatedRoutingV1HttpApiClient('https://example.org', { cacheTTL: 0 })
83
+ ```
84
+
71
85
  ### Filtering with IPIP-484
72
86
 
73
87
  The client can be configured to pass filter options to the delegated routing server as defined in IPIP-484.