| 79 | } |
| 80 | |
| 81 | func (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 | |
| 108 | func (s *gstate) processDBFragmentForCache(dbName string, qc *qcode.QCode, data []byte) ([]byte, []RowRef, error) { |
| 109 | if len(data) == 0 || qc == nil { |