MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / handleCleanCache

Method handleCleanCache

internal/nodes/api_stream.go:300–327  ·  view source on GitHub ↗

清理缓存

(message *pb.NodeStreamMessage)

Source from the content-addressed store, hash-verified

298
299// 清理缓存
300func (this *APIStream) handleCleanCache(message *pb.NodeStreamMessage) error {
301 msg := &messageconfigs.ReadCacheMessage{}
302 err := json.Unmarshal(message.DataJSON, msg)
303 if err != nil {
304 this.replyFail(message.RequestId, "decode message data failed: "+err.Error())
305 return err
306 }
307
308 storage, shouldStop, err := this.cacheStorage(message, msg.CachePolicyJSON)
309 if err != nil {
310 return err
311 }
312 if shouldStop {
313 defer func() {
314 storage.Stop()
315 }()
316 }
317
318 err = storage.CleanAll()
319 if err != nil {
320 this.replyFail(message.RequestId, "clean cache failed: "+err.Error())
321 return err
322 }
323
324 this.replyOk(message.RequestId, "ok")
325
326 return nil
327}
328
329// 处理配置变化
330func (this *APIStream) handleNewNodeTask(message *pb.NodeStreamMessage) error {

Callers 1

loopMethod · 0.95

Calls 6

replyFailMethod · 0.95
cacheStorageMethod · 0.95
replyOkMethod · 0.95
StopMethod · 0.65
CleanAllMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected