Documentation
¶
Index ¶
- Constants
- type CacheStats
- type EventCache
- func (c *EventCache) Get(f *filter.F) (serializedJSON [][]byte, found bool)
- func (c *EventCache) GetEvents(f *filter.F) (events []*event.E, found bool)
- func (c *EventCache) Invalidate()
- func (c *EventCache) PutEvents(f *filter.F, events []*event.E)
- func (c *EventCache) PutJSON(f *filter.F, marshaledJSON [][]byte)
- func (c *EventCache) Stats() CacheStats
- type EventCacheEntry
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) GetEvents ¶ added in v0.29.11
GetEvents retrieves cached events for a filter (decompresses and deserializes on the fly) This is the new method that returns event.E objects instead of marshaled JSON
func (*EventCache) Invalidate ¶
func (c *EventCache) Invalidate()
Invalidate clears all entries (called when new events are stored)
func (*EventCache) PutEvents ¶ added in v0.29.11
func (c *EventCache) PutEvents(f *filter.F, events []*event.E)
PutEvents stores events in the cache with ZSTD compression This should be called AFTER events are sent to the client
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