Skip to content

Commit

Permalink
increase TTL of values that do not change in the DwnDataStore impleme…
Browse files Browse the repository at this point in the history
…ntation
  • Loading branch information
LiranCohen committed Aug 27, 2024
1 parent 0c375f0 commit dc5e65f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/agent/src/store-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,19 @@ export class DwnDataStore<TStoreObject extends Record<string, any> = Jwk> implem

/**
* Index for mappings from Store Identifier to DWN record ID.
* Since these values don't change, we can use a long TTL.
*
* Up to 1,000 entries are retained for 2 hours.
* Up to 1,000 entries are retained for 30 days.
*/
protected _index = new TtlCache<string, string>({ ttl: ms('2 hours'), max: 1000 });
protected _index = new TtlCache<string, string>({ ttl: ms('30 days'), max: 1000 });

/**
* 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('1 hour'), max: 1000 });
protected _protocolInitializedCache: TtlCache<string, boolean> = new TtlCache({ ttl: ms('30 days'), max: 1000 });

/**
* The protocol assigned to this storage instance.
Expand Down

0 comments on commit dc5e65f

Please sign in to comment.