MCPcopy
hub / github.com/fish2018/pansou / saveMetadata

Method saveMetadata

util/cache/disk_cache.go:98–105  ·  view source on GitHub ↗

保存元数据

(key string, meta *diskCacheMetadata)

Source from the content-addressed store, hash-verified

96
97// 保存元数据
98func (c *DiskCache) saveMetadata(key string, meta *diskCacheMetadata) error {
99 metadataFile := filepath.Join(c.path, c.getFilename(key)+".meta")
100 data, err := json.Marshal(meta)
101 if err != nil {
102 return err
103 }
104 return ioutil.WriteFile(metadataFile, data, 0644)
105}
106
107// 获取文件名
108func (c *DiskCache) getFilename(key string) string {

Callers 2

SetMethod · 0.95
GetMethod · 0.95

Calls 2

getFilenameMethod · 0.95
MarshalFunction · 0.92

Tested by

no test coverage detected