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

Method AddToList

internal/caches/storage_memory.go:389–403  ·  view source on GitHub ↗

AddToList 将缓存添加到列表

(item *Item)

Source from the content-addressed store, hash-verified

387
388// AddToList 将缓存添加到列表
389func (this *MemoryStorage) AddToList(item *Item) {
390 // skip added item
391 if item.MetaSize > 0 {
392 return
393 }
394
395 item.MetaSize = int64(len(item.Key)) + 128 /** 128是我们评估的数据结构的长度 **/
396 var hash = types.String(this.hash(item.Key))
397
398 if len(item.Host) == 0 {
399 item.Host = ParseHost(item.Key)
400 }
401
402 _ = this.list.Add(hash, item)
403}
404
405// TotalDiskSize 消耗的磁盘尺寸
406func (this *MemoryStorage) TotalDiskSize() int64 {

Callers 1

TestMemoryStorage_PurgeFunction · 0.95

Calls 4

hashMethod · 0.95
ParseHostFunction · 0.85
AddMethod · 0.65
StringMethod · 0.45

Tested by 1

TestMemoryStorage_PurgeFunction · 0.76