MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / DeleteCachedSignatureRequired

Function DeleteCachedSignatureRequired

internal/cache/signature_cache.go:252–278  ·  view source on GitHub ↗

DeleteCachedSignatureRequired removes one exact cached signature.

(ctx context.Context, modelName, text string)

Source from the content-addressed store, hash-verified

250
251// DeleteCachedSignatureRequired removes one exact cached signature.
252func DeleteCachedSignatureRequired(ctx context.Context, modelName, text string) error {
253 if text == "" {
254 return nil
255 }
256 if client, homeMode, errClient := currentSignatureKVClient(); homeMode {
257 if errClient != nil {
258 return errClient
259 }
260 _, errDel := client.KVDel(ctx, signatureKVKey(modelName, text))
261 return errDel
262 }
263 groupKey := GetModelGroup(modelName)
264 textHash := hashText(text)
265 val, ok := signatureCache.Load(groupKey)
266 if !ok {
267 return nil
268 }
269 sc := val.(*groupCache)
270 sc.mu.Lock()
271 delete(sc.entries, textHash)
272 isEmpty := len(sc.entries) == 0
273 sc.mu.Unlock()
274 if isEmpty {
275 signatureCache.Delete(groupKey)
276 }
277 return nil
278}
279
280// HasValidSignature checks if a signature is valid (non-empty and long enough)
281func HasValidSignature(modelName, signature string) bool {

Calls 6

signatureKVKeyFunction · 0.85
GetModelGroupFunction · 0.85
hashTextFunction · 0.85
KVDelMethod · 0.65
LoadMethod · 0.65
DeleteMethod · 0.65