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

Method fragmentCacheSet

core/cache_fragment.go:81–106  ·  view source on GitHub ↗
(
	ctx context.Context,
	key string,
	data []byte,
	refs []RowRef,
	start time.Time,
	opts CacheEntryOptions,
)

Source from the content-addressed store, hash-verified

79}
80
81func (s *gstate) fragmentCacheSet(
82 ctx context.Context,
83 key string,
84 data []byte,
85 refs []RowRef,
86 start time.Time,
87 opts CacheEntryOptions,
88) {
89 if key == "" || len(data) == 0 || s.gj == nil || s.gj.responseCache == nil {
90 return
91 }
92 if len(data) > maxResponseSize {
93 return
94 }
95 if opts.NoStore {
96 return
97 }
98 if setter, ok := s.gj.responseCache.(ResponseCacheProviderWithOptions); ok {
99 _ = setter.SetWithOptions(ctx, key, data, refs, start, opts)
100 return
101 }
102 if opts.HardTTL > 0 || opts.FreshTTL > 0 {
103 return
104 }
105 _ = s.gj.responseCache.Set(ctx, key, data, refs, start)
106}
107
108func (s *gstate) processDBFragmentForCache(dbName string, qc *qcode.QCode, data []byte) ([]byte, []RowRef, error) {
109 if len(data) == 0 || qc == nil {

Callers 5

executeMethod · 0.95
resolveRemotesMethod · 0.95

Calls 2

SetWithOptionsMethod · 0.65
SetMethod · 0.65

Tested by 1