Commit b2997180 by tasnimsunny Committed by Oliver Woodman

Make removal of non-existent cache span a no-op

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155413733
parent 812068a2
......@@ -286,7 +286,9 @@ public final class SimpleCache implements Cache {
private void removeSpan(CacheSpan span, boolean removeEmptyCachedContent) throws CacheException {
CachedContent cachedContent = index.get(span.key);
Assertions.checkState(cachedContent.removeSpan(span));
if (cachedContent == null || !cachedContent.removeSpan(span)) {
return;
}
totalSpace -= span.length;
if (removeEmptyCachedContent && cachedContent.isEmpty()) {
index.removeEmpty(cachedContent.key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment