Documentation
¶
Overview ¶
Package memory exposes process-wide cache reclamation hooks for modules and downstream products built on Sailry Harness.
Index ¶
- Constants
- func CheckPressure() bool
- func IsKindRegistered(kind string) bool
- func IsScopeRegistered(scope string) bool
- func Register(name string, trim func(Level)) func()
- func RegisterKind(kind string)
- func RegisterScope(scope string)
- func RegisteredKinds() []string
- func RegisteredScopes() []string
- func Trim(level Level)
- type Level
Constants ¶
const ( // Idle runs on periodic background ticks to evict expired or inactive entries. Idle = internalmemory.Idle // Pressure runs when Go heap metrics cross high-water thresholds. Pressure = internalmemory.Pressure )
Variables ¶
This section is empty.
Functions ¶
func CheckPressure ¶
func CheckPressure() bool
CheckPressure samples Go heap metrics and runs Trim(Pressure) when heap usage exceeds high-water thresholds outside the cooldown window.
func IsKindRegistered ¶
IsKindRegistered reports whether kind is currently registered.
func IsScopeRegistered ¶
IsScopeRegistered reports whether scope is currently registered.
func Register ¶
Register attaches a trim callback to the process-wide memory Governor and returns an idempotent unregister function.
func RegisterKind ¶
func RegisterKind(kind string)
RegisterKind registers a memory kind for new writes and memory tool schemas. Built-in kinds are "user", "feedback", and "reference".
func RegisterScope ¶
func RegisterScope(scope string)
RegisterScope registers a memory scope. Built-in scopes are "global" and "bot".
func RegisteredKinds ¶
func RegisteredKinds() []string
RegisteredKinds returns a copy of all currently registered memory kinds.
func RegisteredScopes ¶
func RegisteredScopes() []string
RegisteredScopes returns a copy of all currently registered memory scopes.
Types ¶
type Level ¶
type Level = internalmemory.Level
Level describes how aggressively registered caches should reclaim memory.