Skip to content

Add option to disable adding File.lastModified to the cache key.#415

Merged
colinrtwhite merged 4 commits into
masterfrom
colin/support_disabling_last_modified
May 26, 2020
Merged

Add option to disable adding File.lastModified to the cache key.#415
colinrtwhite merged 4 commits into
masterfrom
colin/support_disabling_last_modified

Conversation

@colinrtwhite
Copy link
Copy Markdown
Member

Fixes #383 by adding an option to disable the lastModified check.

@colinrtwhite colinrtwhite requested a review from Jawnnypoo May 24, 2020 06:03
Comment thread coil-base/src/androidTest/java/coil/util/SystemCallbacksTest.kt Outdated
override fun key(data: File) = "${data.path}:${data.lastModified()}"
override fun key(data: File): String {
return if (addLastModifiedToFileCacheKey) {
"${data.path}:${data.lastModified()}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never would have guessed this triggers a strict mode violation 😮

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! It's very unlikely to cause performance issues as we're only reading the file's metadata, but technically we touch the file system from the main thread.

@colinrtwhite colinrtwhite merged commit f610361 into master May 26, 2020
@colinrtwhite colinrtwhite deleted the colin/support_disabling_last_modified branch May 26, 2020 19:51
colinrtwhite added a commit that referenced this pull request Oct 5, 2022
* Add option to disable adding File.lastModified to the cache key.

* Fix.

* Update API.

* Add argument names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StrictMode DiskReadViolation when loading image File from disk

2 participants