Site Tools


llmcpp-explicit-cache-keys

Table of Contents

Explicit cache keys (llmcpp)

Explicit cache keys pin a previously generated implementation independently of newly computed inputs. The modifier accepts a full hash or an unambiguous prefix:

__llm__(key("abcdef0"), offline)
int twice(int value)
{
    Return twice value.
}

Here abcdef0 is illustrative: replace it with a real cache key. offline makes a missing entry fail without generation. Without it, a miss can generate and store a body under the supplied key.

Keys require seven to sixty-four hexadecimal characters; ambiguous prefixes are errors. They enable caching and cannot be combined with no_cache. Lifetime still applies.

A pinned body must still compile in the current program, and changing the prompt does not adapt its behavior. Review the implementation when its intended contract changes.

llmcpp-explicit-cache-keys.md · Last modified: by 127.0.0.1