Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing from Cache not working as intended? #9

Closed
ABausG opened this issue Nov 15, 2017 · 2 comments
Closed

Removing from Cache not working as intended? #9

ABausG opened this issue Nov 15, 2017 · 2 comments

Comments

@ABausG
Copy link

ABausG commented Nov 15, 2017

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:

  1. Matching the url to the Regex - did not work as it is not the key
  2. 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?

@ABausG
Copy link
Author

ABausG commented Nov 16, 2017

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

@ABausG
Copy link
Author

ABausG commented Nov 18, 2017

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.

@ABausG ABausG closed this as completed Nov 18, 2017
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

No branches or pull requests

1 participant