@credo-ts/core
Version:
<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1
31 lines • 1.5 kB
text/typescript
import { Cache, CacheOptions } from "./Cache.mjs";
import { AgentContext } from "../../agent/context/AgentContext.mjs";
import "../../agent/context/index.mjs";
//#region src/modules/cache/InMemoryLruCache.d.ts
export interface InMemoryLruCacheOptions {
/** The maximum number of entries allowed in the cache */
limit: number;
}
/**
* In memory LRU cache.
*
* This cache can be used with multiple agent context instances. Keys are namespaced by the
* `contextCorrelationId` of the agent context by default, and by `global:` for entries using the
* `'global'` scope. Note that separate root agent instances sharing this cache also share the
* `default` context namespace.
*
* The `limit` applies to the cache as a whole, spanning all contexts and the global scope, so a
* busy context can evict entries of other contexts. `clear()` also clears all scopes and contexts.
*/
export declare class InMemoryLruCache implements Cache {
private readonly cache;
constructor({ limit }: InMemoryLruCacheOptions);
private getNamespacedKey;
get<CacheValue>(agentContext: AgentContext, key: string, options?: CacheOptions): Promise<CacheValue | null>;
set<CacheValue>(agentContext: AgentContext, key: string, value: CacheValue, expiresInSeconds?: number, options?: CacheOptions): Promise<void>;
clear(): void;
remove(agentContext: AgentContext, key: string, options?: CacheOptions): Promise<void>;
private removeExpiredItems;
}
//#endregion
//# sourceMappingURL=InMemoryLruCache.d.mts.map