Removing from Cache not working as intended?
ABausG opened this issue · comments
Trying to remove a Website from the Cache using Fuse.stringCache.remove(url)
url is the String of the Website I used to download.
However when using it like so I get the following Exception:
java.lang.IllegalArgumentException: keys must match regex [a-z0-9_-]{1,64}: "https://www.wired.com/2017/11/gifts-for-the-apple-iphone-lover/"
at com.jakewharton.disklrucache.DiskLruCache.validateKey(DiskLruCache.java:660)
at com.jakewharton.disklrucache.DiskLruCache.remove(DiskLruCache.java:581)
at com.github.kittinunf.fuse.core.cache.DiskCache.remove(DiskCache.kt:40)
at com.github.kittinunf.fuse.core.Cache.remove(Cache.kt:113)
at com.github.kittinunf.fuse.core.Cache.remove$default(Cache.kt:110)
What I tried:
- Matching the url to the Regex - did not work as it is not the key
- Calling it using
Fuse.stringCache.remove(URL(url).toString())
also not finding the Item to remove
What worked was Fuse.stringCache.remove(url.md5())
. Is that the way it is supposed to work?
Edit: This did not remove the Value from the Cache
Maybe adding a function to remove Items by URL similar to the get function would be a consideration?
Tried a bit more. The URL seems to be the right key as I get the Data when I call it with get. However using it with remove()
produces the IllegalArgumentException with the wrong regex
Found my Error. I was using the 0.2.0
instead of the 0.2.0-new
version. Now it works as intended.
However: Android Studio Lint Checker is recommending the 0.2.0 Version as it thinks it is newer. Don't know how to fix that.