Protected
cacheThe underlying LevelDB store used for caching.
Protected
ttlThe time-to-live for cache entries in milliseconds.
Retrieves a DID resolution result from the cache.
If the cached item has exceeded its TTL, it's scheduled for deletion and undefined is returned.
The DID string used as the key for retrieving the cached result.
The cached DID resolution result or undefined if not found or expired.
Stores a DID resolution result in the cache with a TTL.
The DID string used as the key for storing the result.
The DID resolution result to be cached.
A promise that resolves when the operation is complete.
A Level-based cache implementation for storing and retrieving DID resolution results.
This cache uses LevelDB for storage, allowing data persistence across process restarts or browser refreshes. It's suitable for both Node.js and browser environments.
Remarks
The LevelDB cache keeps data in memory for fast access and also writes to the filesystem in Node.js or indexedDB in browsers. Time-to-live (TTL) for cache entries is configurable.
Example