# Class CliDetectionCache

CLI detection cache implementation. Thread-safe for Node.js single-threaded execution.

#### Implements

- ICliDetectionCache

- Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:113

##### Index

### Constructors

constructor

### Methods

get
set
isStale
getEffectiveTtl
invalidate
getAll
getStats
resetStats
fromHealthStatus

## Constructors

### constructor

- new CliDetectionCache(
  config?: Partial<CliDetectionCacheConfig>,
  ): CliDetectionCache

  #### Parameters

  - `Optional` config: Partial<CliDetectionCacheConfig>

  #### Returns CliDetectionCache

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:123

## Methods

### get

- get(
  cli: "claude" | "gemini" | "codex" | "opencode",
  ): CliHealthResult | undefined

  Get cached health result for a CLI

  #### Parameters

  - cli: "claude" | "gemini" | "codex" | "opencode"

  #### Returns CliHealthResult | undefined

  Implementation of ICliDetectionCache.get

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:137

### set

- set(
  cli: "claude" | "gemini" | "codex" | "opencode",
  result: CliHealthResult,
  ): void

  Set health result for a CLI

  #### Parameters

  - cli: "claude" | "gemini" | "codex" | "opencode"
  - result: CliHealthResult

  #### Returns void

  Implementation of ICliDetectionCache.set

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:157

### isStale

- isStale(cli: "claude" | "gemini" | "codex" | "opencode"): boolean

  Check if cache entry is stale

  #### Parameters

  - cli: "claude" | "gemini" | "codex" | "opencode"

  #### Returns boolean

  Implementation of ICliDetectionCache.isStale

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:167

### getEffectiveTtl

- getEffectiveTtl(cli: "claude" | "gemini" | "codex" | "opencode"): number

  Returns the effective TTL for a CLI, applying adaptive multiplier if enabled.

  #### Parameters

  - cli: "claude" | "gemini" | "codex" | "opencode"

  #### Returns number

  Implementation of ICliDetectionCache.getEffectiveTtl

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:176

### invalidate

- invalidate(cli?: "claude" | "gemini" | "codex" | "opencode"): void

  Invalidate cache for a specific CLI or all CLIs

  #### Parameters

  - `Optional` cli: "claude" | "gemini" | "codex" | "opencode"

  #### Returns void

  Implementation of ICliDetectionCache.invalidate

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:195

### getAll

- getAll(): ReadonlyMap<
  "claude"
  | "gemini"
  | "codex"
  | "opencode",
  CliHealthResult,
  >

  Get all cached results

  #### Returns ReadonlyMap<"claude" | "gemini" | "codex" | "opencode", CliHealthResult>

  Implementation of ICliDetectionCache.getAll

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:207

### getStats

- getStats(): CliCacheStats

  Get cache statistics

  #### Returns CliCacheStats

  Implementation of ICliDetectionCache.getStats

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:211

### resetStats

- resetStats(): void

  Resets cache statistics.

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:225

### `Static` fromHealthStatus

- fromHealthStatus(status: HealthStatus): CliHealthResult

  Converts HealthStatus to CliHealthResult for caching.

  #### Parameters

  - status: HealthStatus

  #### Returns CliHealthResult

  - Defined in packages/nexus-agents/src/cli-adapters/cli-detection-cache.ts:235