(key string)
| 65 | } |
| 66 | |
| 67 | func (c FileCache) cacheFilePath(key string) (string, error) { |
| 68 | cacheDirectory, err := directories.Cache() |
| 69 | if err != nil { |
| 70 | return "", err |
| 71 | } |
| 72 | hash := sha256.Sum256([]byte(key)) |
| 73 | fileName := hex.EncodeToString(hash[:]) |
| 74 | return filepath.Join(cacheDirectory, fileName), nil |
| 75 | } |
| 76 | |
| 77 | func NewFileCache() *FileCache { |
| 78 | return &FileCache{} |