> For the complete documentation index, see [llms.txt](https://triton.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritoncachemanager.md).

# TritonCacheManager

Centralizes Triton's Salesforce Platform Cache (Org cache) operations, with a test-friendly mock backend.

## Overview

`TritonCacheManager` wraps all of Triton's Platform Cache access. In production it delegates to `Cache.Org`; in test context it uses an in-memory map (because platform cache `put()` can succeed silently while `get()` returns null under test). It backs transaction-ID caching (via [`TritonHelper`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonhelper.md) and [`Triton.withCache()`](https://triton.pharos.ai/methods-reference/apex-methods-reference/triton.md#withcache)) and the deferred Flow-log buffer used by [`TritonFlowFlushBatch`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonflowflushbatch.md).

This is an internal utility — you rarely call it directly.

## Org Cache Methods

#### put(String key, Object value, Integer ttl)

{% code lineNumbers="true" %}

```apex
public static void put(String key, Object value, Integer ttl)
```

{% endcode %}

Stores a value in Org cache under `key` with a time-to-live of `ttl` seconds.

#### get(String key)

{% code lineNumbers="true" %}

```apex
public static Object get(String key)
```

{% endcode %}

Retrieves a value from Org cache. Returns `null` when the key is absent.

#### getKeys()

{% code lineNumbers="true" %}

```apex
public static Set<String> getKeys()
```

{% endcode %}

Returns all keys currently in Org cache.

#### remove(String key)

{% code lineNumbers="true" %}

```apex
public static void remove(String key)
```

{% endcode %}

Removes a key from Org cache.

## Availability

#### available()

{% code lineNumbers="true" %}

```apex
public static Boolean available()
```

{% endcode %}

Returns `true` when Org cache is usable. `Triton.withCache()` uses this to decide whether to enable cache-backed transaction management.

**Returns:**

* `true` if Org cache is available (always `true` in test context), otherwise `false`
