1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
diff --git a/overlay.go b/overlay.go
index 512bf1c77ece17e9cc8deba0777e8c8ea60d8e10..2c14fc35805bfe0b128a2d164e5beaafb71e28f2 100644
--- a/overlay.go
+++ b/overlay.go
@@ -18,12 +18,17 @@ doCache bool
cache map[string]bool
}
+// PurgeCache purges the cache
+func (f *FS) PurgeCache() {
+ f.cache = make(map[string]bool)
+}
+
func (f *FS) apn(name string) string {
return path.Join(f.root, name)
}
func (f *FS) exists(name string) bool {
- if has, ok := f.cache[name]; ok && f.doCache {
+ if has, ok := f.cache[name]; ok {
return has
}
_, err := os.Stat(f.apn(name))
@@ -63,10 +68,9 @@
// New returns a new FS
func New(root string, fs fs.FS, opts ...Option) (*FS, error) {
x := &FS{
- fs: fs,
- root: root,
- doCache: true,
- cache: make(map[string]bool),
+ fs: fs,
+ root: root,
+ cache: make(map[string]bool),
}
for _, opt := range opts {
|