Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Update DiskLruCache.java #67

Closed
wants to merge 1 commit into from
Closed

Conversation

lidongbo
Copy link

the cache needs to be overwrite with the new value

the cache needs to be overwrite by new value
@lidongbo
Copy link
Author

what is the benefit that the logic is "dirty.renameTo(clean);" rather than "renameTo(dirty, clean, true)" ?

@lidongbo
Copy link
Author

Run com.jakewharton.disklrucache.DiskLruCacheTest.readAndWriteOverlapsMaintainConsistency will be failure , the cause is snapshot2.getString(0) will not equal "CCcc" in line 287 (the result error is org.junit.ComparisonFailure: expected:<'[CCcc]'> but was:<'[AAaa]' )

the new value was not overwrite the old cache ,because the dirty dos not rename to clean successful.

@JakeWharton
Copy link
Owner

Changing this would make the commit non-atomic. Additionally, if that test is now failing with the change you are breaking the intended behavior of the snapshots.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants