MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / AddToList

Method AddToList

internal/caches/storage_file.go:730–750  ·  view source on GitHub ↗

AddToList 添加到List

(item *Item)

Source from the content-addressed store, hash-verified

728
729// AddToList 添加到List
730func (this *FileStorage) AddToList(item *Item) {
731 // 是否正在退出
732 if teaconst.IsQuiting {
733 return
734 }
735
736 var memoryStorage = this.memoryStorage
737 if memoryStorage != nil {
738 if item.Type == ItemTypeMemory {
739 memoryStorage.AddToList(item)
740 return
741 }
742 }
743
744 item.MetaSize = SizeMeta + 128
745 var hash = stringutil.Md5(item.Key)
746 err := this.list.Add(hash, item)
747 if err != nil && !strings.Contains(err.Error(), "UNIQUE constraint failed") {
748 remotelogs.Error("CACHE", "add to list failed: "+err.Error())
749 }
750}
751
752// Delete 删除某个键值对应的缓存
753func (this *FileStorage) Delete(key string) error {

Callers

nothing calls this directly

Calls 5

ErrorFunction · 0.92
AddToListMethod · 0.65
AddMethod · 0.65
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected