MCPcopy Create free account
hub / github.com/VKCOM/nocc / MakeFileCache

Function MakeFileCache

internal/server/file-cache.go:54–65  ·  view source on GitHub ↗
(cacheDir string, limitBytes int64)

Source from the content-addressed store, hash-verified

52}
53
54func MakeFileCache(cacheDir string, limitBytes int64) (*FileCache, error) {
55 if err := createSubdirsForFileCache(cacheDir); err != nil {
56 return nil, err
57 }
58
59 return &FileCache{
60 table: make(map[common.SHA256]cachedFile, 128*1024),
61 cacheDir: cacheDir,
62 hardLimit: limitBytes,
63 softLimit: int64(80.0 * (float64(limitBytes) / 100.0)),
64 }, nil
65}
66
67func (cache *FileCache) LookupInCache(key common.SHA256) string {
68 cache.mu.Lock()

Callers 2

MakeObjFileCacheFunction · 0.85
MakeSrcFileCacheFunction · 0.85

Calls 1

Tested by

no test coverage detected