| 73 | } |
| 74 | |
| 75 | func (c *Client) SetupFileCache(path string) error { |
| 76 | stat, err := os.Stat(path) |
| 77 | if err != nil { |
| 78 | return errors.Wrap(err, tr.Tr.Get("lock cache initialization")) |
| 79 | } |
| 80 | |
| 81 | lockFile := path |
| 82 | if stat.IsDir() { |
| 83 | lockFile = filepath.Join(path, "lockcache.db") |
| 84 | } |
| 85 | |
| 86 | cache, err := NewLockCache(lockFile) |
| 87 | if err != nil { |
| 88 | return errors.Wrap(err, tr.Tr.Get("lock cache initialization")) |
| 89 | } |
| 90 | |
| 91 | c.cache = cache |
| 92 | c.cacheDir = filepath.Join(path, "cache") |
| 93 | return nil |
| 94 | } |
| 95 | |
| 96 | // Close this client instance; must be called to dispose of resources |
| 97 | func (c *Client) Close() error { |