cache

package
v6.9.2-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignatureCacheTTL is how long signatures are valid
	SignatureCacheTTL = 3 * time.Hour

	// SignatureTextHashLen is the length of the hash key (16 hex chars = 64-bit key space)
	SignatureTextHashLen = 16

	// MinValidSignatureLen is the minimum length for a signature to be considered valid
	MinValidSignatureLen = 50

	// CacheCleanupInterval controls how often stale entries are purged
	CacheCleanupInterval = 10 * time.Minute
)

Variables

This section is empty.

Functions

func CacheSignature

func CacheSignature(modelName, text, signature string)

CacheSignature stores a thinking signature for a given model group and text. Used for Claude models that require signed thinking blocks in multi-turn conversations.

func ClearSignatureCache

func ClearSignatureCache(modelName string)

ClearSignatureCache clears signature cache for a specific model group or all groups.

func GetCachedSignature

func GetCachedSignature(modelName, text string) string

GetCachedSignature retrieves a cached signature for a given model group and text. Returns empty string if not found or expired.

func GetModelGroup

func GetModelGroup(modelName string) string

func HasValidSignature

func HasValidSignature(modelName, signature string) bool

HasValidSignature checks if a signature is valid (non-empty and long enough)

Types

type SignatureEntry

type SignatureEntry struct {
	Signature string
	Timestamp time.Time
}

SignatureEntry holds a cached thinking signature with timestamp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL