Skip to Content

cache

Module: vibex/cache

XAgent Cache - Simple cache for XAgent instances

Keeps XAgent instances alive for the entire application lifecycle to avoid recreating agents and maintain space context.

Classes

XAgentCache

View source

Methods:

get

View source

Get or create an XAgent instance for a space

function get(spaceId: string, options: XOptions): Promise<XAgent>

Parameters:

NameTypeDescription
spaceIdstring
optionsXOptions

remove

View source

Remove an XAgent instance from cache (optional cleanup)

function remove(spaceId: string): void

Parameters:

NameTypeDescription
spaceIdstring

clear

View source

Clear all cached instances (for testing or reset)

function clear(): void

getStats

View source

Get cache statistics

function getStats(): { size: number; spaceIds: string[] }