cache

package
v6.6.41 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

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

	// MaxEntriesPerSession limits memory usage per session
	MaxEntriesPerSession = 100

	// 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
)

Variables

This section is empty.

Functions

func CacheSignature

func CacheSignature(sessionID, text, signature string)

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

func ClearSignatureCache

func ClearSignatureCache(sessionID string)

ClearSignatureCache clears signature cache for a specific session or all sessions.

func GetCachedSignature

func GetCachedSignature(sessionID, text string) string

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

func HasValidSignature

func HasValidSignature(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