Skip to content

Commit 309053e

Browse files
committed
docs: update with example
1 parent 9c8636c commit 309053e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/client/src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@
3939
* await libp2p.peerRouting.findPeer(peerIdFromString('QmFoo'))
4040
* ```
4141
*
42+
* ### Caching
43+
*
44+
* By default, the client caches responses in browser environments for a duration of 5 minutes.
45+
*
46+
* If caching is enabled, the client will cache responses for the duration of `cacheTTL` milliseconds.
47+
* If `cacheTTL` is 0, caching is disabled:
48+
*
49+
* @example
50+
*
51+
* ```typescript
52+
* // disable caching
53+
* const client = createDelegatedRoutingV1HttpApiClient('https://example.org', { cacheTTL: 0 })
54+
* ```
55+
*
4256
* ### Filtering with IPIP-484
4357
*
4458
* The client can be configured to pass filter options to the delegated routing server as defined in IPIP-484.

0 commit comments

Comments
 (0)