improve query cache with zstd level 9
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

This commit is contained in:
2025-11-16 20:52:18 +00:00
parent dfe8b5f8b2
commit 511b8cae5f
7 changed files with 301 additions and 80 deletions

View File

@@ -51,14 +51,6 @@ func (d *D) QueryAllVersions(c context.Context, f *filter.F) (
func (d *D) QueryEventsWithOptions(c context.Context, f *filter.F, includeDeleteEvents bool, showAllVersions bool) (
evs event.S, err error,
) {
// Try cache first (only for standard queries, not special cases)
if d.queryCache != nil && !showAllVersions && includeDeleteEvents {
if cachedEvents, found := d.queryCache.Get(f); found {
log.D.F("QueryEventsWithOptions: returning %d cached events", len(cachedEvents))
return cachedEvents, nil
}
}
// Determine if we should return multiple versions of replaceable events
// based on the limit parameter
wantMultipleVersions := showAllVersions || (f.Limit != nil && *f.Limit > 1)
@@ -592,12 +584,6 @@ func (d *D) QueryEventsWithOptions(c context.Context, f *filter.F, includeDelete
}()
}
// Populate cache with results (only for standard queries)
if d.queryCache != nil && !showAllVersions && includeDeleteEvents && len(evs) > 0 {
d.queryCache.Put(f, evs)
log.D.F("QueryEventsWithOptions: cached %d events", len(evs))
}
return
}