Documentation
¶
Index ¶
- type Cache
- func (c *Cache) Clear(ctx context.Context)
- func (c *Cache) Delete(ctx context.Context, key string)
- func (c *Cache) Get(ctx context.Context, key string) (interface{}, bool)
- func (c *Cache) GetOrSet(ctx context.Context, key string, factory func() (interface{}, error), ...) (interface{}, error)
- func (c *Cache) HashKey(components ...string) string
- func (c *Cache) Set(ctx context.Context, key string, value interface{}, ttl ...time.Duration)
- func (c *Cache) Stats() map[string]interface{}
- type CacheEntry
- type CacheManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides thread-safe caching with TTL support
func (*Cache) GetOrSet ¶
func (c *Cache) GetOrSet(ctx context.Context, key string, factory func() (interface{}, error), ttl ...time.Duration) (interface{}, error)
GetOrSet retrieves a value or sets it if not found
type CacheEntry ¶
type CacheEntry struct {
Value interface{} `json:"value"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
AccessCount int64 `json:"access_count"`
LastAccess time.Time `json:"last_access"`
}
CacheEntry represents a cached item with expiration
type CacheManager ¶
type CacheManager struct {
EmbeddingsCache *Cache
LLMResponseCache *Cache
SchemaCache *Cache
DocumentationCache *Cache
// contains filtered or unexported fields
}
CacheManager manages multiple specialized caches
func NewCacheManager ¶
func NewCacheManager(logger logger.Logger) *CacheManager
NewCacheManager creates a new cache manager with pre-configured caches
func (*CacheManager) ClearAll ¶
func (cm *CacheManager) ClearAll(ctx context.Context)
ClearAll clears all managed caches
func (*CacheManager) GenerateCacheKey ¶
func (cm *CacheManager) GenerateCacheKey(prefix string, components ...string) string
GenerateCacheKey creates a consistent cache key for different contexts
func (*CacheManager) GetGlobalStats ¶
func (cm *CacheManager) GetGlobalStats() map[string]interface{}
GetGlobalStats returns statistics for all caches
Click to show internal directories.
Click to hide internal directories.