Typo
Fix race condition leading to removal of the wrong cache entry
Replace unbounded while loop by bounded for loop to avoid resource starvation
Improve stale check by also looking at the header value