Skip to content

Commit

Permalink
fix lint issue, add comment to agent resolver cache get method
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Aug 27, 2024
1 parent dc5e65f commit d0bdeef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/agent/src/agent-did-resolver-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DidResolutionResult | void> {
try {
const str = await this.cache.get(did);
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/store-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class DwnDataStore<TStoreObject extends Record<string, any> = 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<string, boolean> = new TtlCache({ ttl: ms('30 days'), max: 1000 });
Expand Down

0 comments on commit d0bdeef

Please sign in to comment.