(cacheDir string, limitBytes int64)
| 52 | } |
| 53 | |
| 54 | func 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 | |
| 67 | func (cache *FileCache) LookupInCache(key common.SHA256) string { |
| 68 | cache.mu.Lock() |
no test coverage detected