MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / canCacheQuery

Function canCacheQuery

utils.go:180–195  ·  view source on GitHub ↗

canCacheQuery returns true if q can be cached.

(q []byte)

Source from the content-addressed store, hash-verified

178
179// canCacheQuery returns true if q can be cached.
180func canCacheQuery(q []byte) bool {
181 q = skipLeadingComments(q)
182
183 for _, statement := range cachableStatements {
184 if len(q) < len(statement) {
185 continue
186 }
187
188 l := bytes.ToUpper(q[:len(statement)])
189 if bytes.HasPrefix(l, []byte(statement)) {
190 return true
191 }
192 }
193
194 return false
195}
196
197//nolint:cyclop // No clean way to split this.
198func skipLeadingComments(q []byte) []byte {

Callers 2

shouldRespondFromCacheFunction · 0.85
testCanCacheQueryFunction · 0.85

Calls 1

skipLeadingCommentsFunction · 0.85

Tested by 1

testCanCacheQueryFunction · 0.68