fix cache to disregard subscription ids
Some checks failed
Go / build-and-release (push) Has been cancelled

This commit is contained in:
2025-11-20 12:30:17 +00:00
parent 1b279087a9
commit 00a6a78a41
7 changed files with 229 additions and 23 deletions

View File

@@ -13,6 +13,7 @@ import (
"lol.mleku.dev"
"lol.mleku.dev/chk"
"next.orly.dev/pkg/database/querycache"
"next.orly.dev/pkg/encoders/event"
"next.orly.dev/pkg/encoders/filter"
"next.orly.dev/pkg/utils/apputil"
"next.orly.dev/pkg/utils/units"
@@ -253,6 +254,22 @@ func (d *D) CacheMarshaledJSON(f *filter.F, marshaledJSON [][]byte) {
}
}
// GetCachedEvents retrieves cached events for a filter (without subscription ID)
// Returns nil, false if not found
func (d *D) GetCachedEvents(f *filter.F) (event.S, bool) {
if d.queryCache == nil {
return nil, false
}
return d.queryCache.GetEvents(f)
}
// CacheEvents stores events for a filter (without subscription ID)
func (d *D) CacheEvents(f *filter.F, events event.S) {
if d.queryCache != nil && len(events) > 0 {
d.queryCache.PutEvents(f, events)
}
}
// Close releases resources and closes the database.
func (d *D) Close() (err error) {
if d.seq != nil {