
Go queries, made simple.
One client. Many data types.
Shared cache, background refresh, and focused invalidation.
go get github.com/Waterkyuu/cacheqQueries & conditions
Share requests, read state, and load when ready.
Query · SetEnabled · UpdatesQuery options
Reuse typed query definitions and share loading options.
QueryOptions · QueryDefinitionCache & lifecycle
Reuse data, refresh in the background, and clean up.
StaleTime · GCTime · PrefetchAutomatic batch loading
Group concurrent requests or load known keys with LoadMany.
NewBatcher · LoadMany · FetcherInvalidation & refresh
Invalidate related data, await refreshes, and coalesce follow-ups.
Invalidate · InvalidateAndWait · RefetchAfterLoadQuery filters
Reuse query selections for refresh, cancellation, and removal.
QueryFilter · Keys · PredicateQuery tags
Declare related queries and refresh, cancel, or remove them by tag.
QueryDefinition.Tags · QueryFilter.TagsObservability
Measure cache hits, shared requests, loads, and cleanup.
StatsDiagnostic events
Trace load causes, shared requests, and removals by key.
SubscribeEvents · LoadID · DroppedMCP resource caching
Share resource reads, preserve TTL, and notify on changes.
FetchWithExpiry · Invalidate · StatsBubble Tea example
Run a task board with shared views, refreshes, and error recovery.
Query · Updates · InvalidateAtomic cache updates
Transform cached data without overwriting concurrent changes.
Update · ErrUpdateConflictMutations & synchronization
Observe writes and synchronize related queries after success.
Mutation · SyncErr · InvalidateExecution budgets
Bound backend concurrency and queued work across consumers.
NewExecutor · MaxConcurrent · MaxQueuedOne client. Different result types.
A User profile and a []User list share the same client, while keeping their types.
type User struct { Name string}
loadUser := func(context.Context) (User, error) { return User{Name: "Alice"}, nil}loadUsers := func(context.Context) ([]User, error) { return []User{{Name: "Alice"}}, nil}
client := cacheq.NewClient(cacheq.Options{ StaleTime: time.Minute,})defer client.Close()
profile := cacheq.Query(client, "user:42", loadUser)users := cacheq.Query(client, "users", loadUsers)defer profile.Close()defer users.Close()