isFileModified checks if the file on disk has been modified compared to cache
(filePath string, cacheEntry *SubsiteCacheEntry)
| 248 | |
| 249 | // isFileModified checks if the file on disk has been modified compared to cache |
| 250 | func isFileModified(filePath string, cacheEntry *SubsiteCacheEntry) bool { |
| 251 | fileInfo, err := os.Stat(filePath) |
| 252 | if err != nil { |
| 253 | // If we can't stat the file, consider it modified |
| 254 | return true |
| 255 | } |
| 256 | |
| 257 | // Check modification time |
| 258 | if fileInfo.ModTime().After(cacheEntry.LastModified) { |
| 259 | return true |
| 260 | } |
| 261 | |
| 262 | // For extra verification, we could also check file size |
| 263 | if fileInfo.Size() != int64(len(cacheEntry.Content)) { |
| 264 | return true |
| 265 | } |
| 266 | |
| 267 | return false |
| 268 | } |
| 269 | |
| 270 | // isCacheExpired checks if a cache entry is expired |
| 271 | func isCacheExpired(entry *SubsiteCacheEntry) bool { |
no test coverage detected