Move map delete inside conditional check to reduce overhead
@@ -112,9 +112,9 @@ func (c *ContentCache) Get(cacheObjectKey *CacheObjectKey) (gcsx.TempFile, bool)
func (c *ContentCache) Remove(cacheObjectKey *CacheObjectKey) {
if cacheObject, exists := c.fileMap[*cacheObjectKey]; exists {
cacheObject.Destroy()
- }
delete(c.fileMap, *cacheObjectKey)
}
+}
// NewCacheFile creates a cache file on the disk storing the object content
// TODO ezl we should refactor reading/writing cache files and metadata to a different package
