dwn-sdk-js
dwn-sdk-js copied to clipboard
Add cache support to DidResolver
Add DIDCache to constructor method signature.
https://github.com/TBD54566975/dwn-sdk-js/blob/fcea84929e12dd3e3ef0e8866b0e592a025786fa/src/did/did-resolver.ts#L9-L17
High level requirements:
- Inject the cache via constructor
- We've implemented an in-memory cache that can be used as the default cache.
i'd like to try this out if someone could guide me
@Cxxshyy, the idea is to:
- Every time DID resolution occurs, check the cache first to see if there is a match:
- If there is match, just return the cached result; if not
- Proceed with normal path of fetching the document from the method resolver, and then cache the result.
Let me know if I am not making sense!
yes i think so. 1st i add the resolvers to the local cache using the set method then in the resolve method i add the get function from cache to check whether the resolver is currently residing in cache at that point in time? elt me know if this is correct.
No no, it's not the list of DidMethodResolver themselves that need caching, it's the result returned by the resolve(...) call, specfically:
const resolutionResult = await didResolver.resolve(did);
resolve(...) is possibly expensive, so adding a cache in front of it would help with perf. Let me know if this still does not make sense.
oh yes that's what i meant by my explanation but i guess i didn't convey it great sorry.
#124 aims to tackle this issue
im now getting this error
although this file hasnt been modified
I think you pulled recently, but you'll also need to do an npm install 'coz dependencies have changed.
Addressed by #155.