Documentation
¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStats ¶
type CacheStats struct {
Entries int
CurrentSize int64 // Compressed size
MaxSize int64
Hits uint64
Misses uint64
HitRate float64
Evictions uint64
Invalidations uint64
CompressionRatio float64 // Average compression ratio
CompactionRuns uint64
}
CacheStats holds cache performance metrics
type EventCache ¶
type EventCache struct {
// contains filtered or unexported fields
}
EventCache caches event.S results from database queries with ZSTD compression
func NewEventCache ¶
func NewEventCache(maxSize int64, maxAge time.Duration) *EventCache
NewEventCache creates a new event cache
func (*EventCache) Get ¶
func (c *EventCache) Get(f *filter.F) (serializedJSON [][]byte, found bool)
Get retrieves cached serialized events for a filter (decompresses on the fly)
func (*EventCache) Invalidate ¶
func (c *EventCache) Invalidate()
Invalidate clears all entries (called when new events are stored)
func (*EventCache) PutJSON ¶
func (c *EventCache) PutJSON(f *filter.F, marshaledJSON [][]byte)
PutJSON stores pre-marshaled JSON in the cache with ZSTD compression This should be called AFTER events are sent to the client with the marshaled envelopes
type EventCacheEntry ¶
type EventCacheEntry struct {
FilterKey string
CompressedData []byte // ZSTD compressed serialized JSON events
UncompressedSize int // Original size before compression (for stats)
CompressedSize int // Actual compressed size in bytes
EventCount int // Number of events in this entry
LastAccess time.Time
CreatedAt time.Time
// contains filtered or unexported fields
}
EventCacheEntry represents a cached set of compressed serialized events for a filter
Source Files
¶
- event_cache.go
Click to show internal directories.
Click to hide internal directories.