kittinunf / Fuse

The simple generic LRU memory/disk cache for Android written in Kotlin

Home Page:https://kittinunf.gitbook.io/fuse/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check for Cached Item

ABausG opened this issue · comments

Is there a way to check if an Item with a given Key is currently cached? Or in other words don't perform a network call when it is not cached?

The only way that you can do now is to ask via get interface. eg.

Fuse.jsonCache.get("foo") { result ->
  val (data, error) = result

  if (data != null) {
    //data is cached earlier 
  }
}

Yeah, I don't think this is convenience. I probably need to improve it somehow. Integrate with RxJava is one way to do just that. If you are willing to open a PR, I am happy to accept the improvement too!

Fixed in the new version! 1.0.0-alpha1