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
Resolving DID Documents can be expensive. It is in most cases best to cache DID documents. Caching has to be
90
-
specifically enabled using the `cache` parameter
89
+
Resolving DID Documents can be expensive. It is in most cases best to cache DID documents. Caching is controlled via the `cache` option, which accepts a boolean value or a custom `DIDCache` function.
91
90
92
-
The built-in cache uses a Map, but does not have an automatic TTL, so entries don't expire. This is fine in most web,
93
-
mobile and serverless contexts. If you run a long-running process you may want to use an existing configurable caching
94
-
system.
91
+
### Built-in caching
95
92
96
-
The built-in Cache can be enabled by passing in a `true` value to the constructor:
93
+
The built-in cache uses a `Map` and does not have an automatic TTL, so entries don't expire. This is fine in most web, mobile and serverless contexts. If you run a long-running process, consider using a custom cache with expiration.
94
+
95
+
Enable the built-in cache by passing `cache: true` to the constructor:
97
96
98
97
```js
99
-
constresolver=newDIDResolver({
98
+
constresolver=newResolver({
100
99
ethr,
101
100
web
102
101
}, {
103
102
cache:true
104
103
})
105
104
```
106
105
107
-
Here is an example using `js-cache` which has not been tested.
106
+
### Disabling cache
107
+
108
+
To disable caching entirely, pass `cache: false`:
109
+
110
+
```js
111
+
constresolver=newResolver({
112
+
ethr,
113
+
web
114
+
}, {
115
+
cache:false
116
+
})
117
+
```
118
+
119
+
### Per-call cache control
120
+
121
+
You can override the global cache setting on a per-call basis using the `cache` option in `DIDResolutionOptions`:
122
+
123
+
```js
124
+
// Global cache enabled, but disable for this specific resolution
0 commit comments