Documentation
¶
Index ¶
- Constants
- func GenerateKey(toolName string, args map[string]interface{}, timestamp time.Time) string
- type Manager
- func (m *Manager) Close()
- func (m *Manager) Get(key string) (*Record, error)
- func (m *Manager) GetRecords(key string, offset, limit int) (*ReadCacheResponse, error)
- func (m *Manager) GetStats() *Stats
- func (m *Manager) Store(key, toolName string, args map[string]interface{}, content, recordPath string, ...) error
- type Meta
- type PathSegment
- type ReadCacheResponse
- type Record
- type Stats
Constants ¶
View Source
const ( CacheBucket = "cache" CacheStatsBucket = "cache_stats" DefaultTTL = 2 * time.Hour CleanupInterval = 10 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles cached tool responses
func NewManager ¶
NewManager creates a new cache manager
func (*Manager) GetRecords ¶
func (m *Manager) GetRecords(key string, offset, limit int) (*ReadCacheResponse, error)
GetRecords retrieves paginated records from a cached response
type Meta ¶
type Meta struct {
Key string `json:"key"`
TotalRecords int `json:"total_records"`
Limit int `json:"limit"`
Offset int `json:"offset"`
TotalSize int `json:"total_size"`
RecordPath string `json:"record_path,omitempty"`
}
Meta represents metadata about the cached response
type PathSegment ¶
type PathSegment struct {
Type string // "object", "array", or "parsed"
Key string // for object access
Index int // for array access
}
PathSegment represents a segment of a JSON path
type ReadCacheResponse ¶
type ReadCacheResponse struct {
Records []interface{} `json:"records"`
Meta Meta `json:"meta"`
}
ReadCacheResponse represents the response structure for read_cache tool
type Record ¶
type Record struct {
Key string `json:"key"`
ToolName string `json:"tool_name"`
Args map[string]interface{} `json:"args"`
Timestamp time.Time `json:"timestamp"`
FullContent string `json:"full_content"`
RecordPath string `json:"record_path,omitempty"` // JSON path to records array
TotalRecords int `json:"total_records,omitempty"` // Total number of records
TotalSize int `json:"total_size"` // Full response size in characters
ExpiresAt time.Time `json:"expires_at"`
AccessCount int `json:"access_count"`
LastAccessed time.Time `json:"last_accessed"`
CreatedAt time.Time `json:"created_at"`
}
Record represents a cached tool response
func (*Record) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler for Record
func (*Record) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler for Record
type Stats ¶
type Stats struct {
TotalEntries int `json:"total_entries"`
TotalSizeBytes int `json:"total_size_bytes"`
HitCount int `json:"hit_count"`
MissCount int `json:"miss_count"`
EvictedCount int `json:"evicted_count"`
CleanupCount int `json:"cleanup_count"`
}
Stats represents cache statistics
func (*Stats) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler for Stats
func (*Stats) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler for Stats
Click to show internal directories.
Click to hide internal directories.