From d0bdeefee3a5e68c097a277dcb9682f03f0456f9 Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Tue, 27 Aug 2024 18:46:41 -0400 Subject: [PATCH] fix lint issue, add comment to agent resolver cache get method --- packages/agent/src/agent-did-resolver-cache.ts | 6 ++++++ packages/agent/src/store-data.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/agent/src/agent-did-resolver-cache.ts b/packages/agent/src/agent-did-resolver-cache.ts index 9312e7dea..ecf35b76b 100644 --- a/packages/agent/src/agent-did-resolver-cache.ts +++ b/packages/agent/src/agent-did-resolver-cache.ts @@ -35,6 +35,12 @@ export class AgentDidResolverCache extends DidResolverCacheLevel implements DidR this._agent = agent; } + /** + * Get the DID resolution result from the cache for the given DID. + * + * If the DID is managed by the agent, or is the agent's own DID, it will not evict it from the cache until a new resolution is successful. + * This is done to achieve quick and offline access to the agent's own managed DIDs. + */ async get(did: string): Promise { try { const str = await this.cache.get(did); diff --git a/packages/agent/src/store-data.ts b/packages/agent/src/store-data.ts index cc99ea5aa..f6f1a3ace 100644 --- a/packages/agent/src/store-data.ts +++ b/packages/agent/src/store-data.ts @@ -64,7 +64,7 @@ export class DwnDataStore = Jwk> implem /** * Cache of tenant DIDs that have been initialized with the protocol. * This is used to avoid redundant protocol initialization requests. - * + * * Since these are default protocols and unlikely to change, we can use a long TTL. */ protected _protocolInitializedCache: TtlCache = new TtlCache({ ttl: ms('30 days'), max: 1000 });