Skip to content

Class: CapabilityCache

nekte-protocol


nekte-protocol / client/src / CapabilityCache

Class: CapabilityCache

Defined in: nekte-source/packages/client/src/cache.ts:58

Constructors

Constructor

new CapabilityCache(config?): CapabilityCache

Defined in: nekte-source/packages/client/src/cache.ts:73

Parameters

config?

CacheConfig

Returns

CapabilityCache

Methods

clear()

clear(): void

Defined in: nekte-source/packages/client/src/cache.ts:191

Returns

void


get()

get(agentId, capId, level): any

Defined in: nekte-source/packages/client/src/cache.ts:135

Get a cached capability at a specific level.

Parameters

agentId

string

capId

string

level

DiscoveryLevel

Returns

any


getHash()

getHash(agentId, capId): string | undefined

Defined in: nekte-source/packages/client/src/cache.ts:127

Get the version hash for a capability. Supports stale-while-revalidate: stale entries trigger background refresh.

Parameters

agentId

string

capId

string

Returns

string | undefined


invalidate()

invalidate(agentId, capId): void

Defined in: nekte-source/packages/client/src/cache.ts:177

Parameters

agentId

string

capId

string

Returns

void


invalidateAgent()

invalidateAgent(agentId): void

Defined in: nekte-source/packages/client/src/cache.ts:181

Parameters

agentId

string

Returns

void


isNegative()

isNegative(agentId, capId): boolean

Defined in: nekte-source/packages/client/src/cache.ts:162

Check if a capability is negatively cached (known not to exist).

Parameters

agentId

string

capId

string

Returns

boolean


isValid()

isValid(agentId, capId, hash): boolean

Defined in: nekte-source/packages/client/src/cache.ts:143

Check if a version hash is still valid.

Parameters

agentId

string

capId

string

hash

string

Returns

boolean


onRevalidate()

onRevalidate(fn): void

Defined in: nekte-source/packages/client/src/cache.ts:85

Register the background revalidation function. Wired by NekteClient to trigger discover() for stale entries.

Parameters

fn

RevalidationFn

Returns

void


set()

set(agentId, cap, level, ttlMs?): void

Defined in: nekte-source/packages/client/src/cache.ts:93

Store a capability at a given discovery level. Clears any negative cache entry for this capability.

Parameters

agentId

string

cap

Capability

level

DiscoveryLevel

ttlMs?

number

Returns

void


setNegative()

setNegative(agentId, capId): void

Defined in: nekte-source/packages/client/src/cache.ts:155

Record that a capability does NOT exist at an agent. Subsequent lookups return undefined without hitting the store.

Parameters

agentId

string

capId

string

Returns

void


stats()

stats(): object

Defined in: nekte-source/packages/client/src/cache.ts:197

Returns

object

agents

agents: number

negatives

negatives: number

size

size: number