MCPcopy
hub / github.com/dosco/graphjin / ResponseCacheProvider

Interface ResponseCacheProvider

core/cache.go:13–25  ·  view source on GitHub ↗

ResponseCacheProvider defines the interface for response caching. This is implemented by the service layer (serv package) to provide Redis-based caching with row-level invalidation.

Source from the content-addressed store, hash-verified

11// This is implemented by the service layer (serv package) to provide
12// Redis-based caching with row-level invalidation.
13type ResponseCacheProvider interface {
14 // Get retrieves a cached response by key.
15 // Returns (data, isStale, found). isStale is true if the entry is past soft TTL (SWR).
16 Get(ctx context.Context, key string) (data []byte, isStale bool, found bool)
17
18 // Set stores a response with dependency refs for invalidation.
19 // refs may represent DB rows/tables, filesystem keys/prefixes, or resolver outputs.
20 // queryStartTime is used for race condition detection.
21 Set(ctx context.Context, key string, data []byte, refs []RowRef, queryStartTime time.Time) error
22
23 // InvalidateRows invalidates cache entries for dependency refs.
24 InvalidateRows(ctx context.Context, refs []RowRef) error
25}
26
27// CacheEntryOptions lets callers narrow cache lifetime for one entry without
28// changing provider-wide defaults.

Callers 13

GetMethod · 0.65
ResolveMethod · 0.65
GraphQLMethod · 0.65
GraphQLByNameMethod · 0.65
fragmentCacheSetMethod · 0.65
tryCacheSetMethod · 0.65
getIntroResultMethod · 0.65
saveToAllowListMethod · 0.65
SubscribeMethod · 0.65
PutMethod · 0.65
DeleteMethod · 0.65
InvalidateCacheRefsMethod · 0.65

Implementers 6

fakeSWRCachecore/swr_test.go
fakeOptionSWRCachecore/swr_test.go
fakeNoSWRCachecore/swr_test.go
recordingResponseCachecore/fstable_bridge_test.go
MemoryCacheserv/cache_memory.go
RedisCacheserv/cache_redis.go

Calls

no outgoing calls

Tested by

no test coverage detected