IsStale checks if any cached file has been modified on disk.
()
| 95 | |
| 96 | // IsStale checks if any cached file has been modified on disk. |
| 97 | func (bl *BootstrapLoader) IsStale() bool { |
| 98 | bl.mu.RLock() |
| 99 | defer bl.mu.RUnlock() |
| 100 | |
| 101 | for path, cached := range bl.cache { |
| 102 | info, err := os.Stat(path) |
| 103 | if err != nil { |
| 104 | // File was deleted; cache is stale |
| 105 | if cached.content != "" { |
| 106 | return true |
| 107 | } |
| 108 | continue |
| 109 | } |
| 110 | if info.ModTime().After(cached.modTime) { |
| 111 | return true |
| 112 | } |
| 113 | } |
| 114 | return false |
| 115 | } |
| 116 | |
| 117 | // InvalidateCache forces reload on next call. |
| 118 | func (bl *BootstrapLoader) InvalidateCache() { |
no outgoing calls