Closed sahityaPasnoor closed 8 years ago
Hi :)
If you want me to help you, you are going to need to copy the code related with the creation of RxCache instance, the provider instance and the way that you are using it.
Instantiation of RxCache
@Singleton
@Provides
ReactiveCache provideReactiveCache() {
return new ReactiveCache.Builder().diskCacheSize(200).using(context.getCacheDir(), new GsonSpeaker());
}
Provider Instance
activeProvider = this.reactiveCache.<UserLoginData>provider().lifeCache(60, TimeUnit.MINUTES).withKey("activeProviderData");
Insertion
userLoginDataObservable.compose(activeProvider.readWithLoader())
Eviction
activeProvider.evict();
evict
returns an Observable
. So, you need to subscribe it.
activeProvider.evict()
.subscribe();
Nice, works now. i totally missed it. Thanks
What about adding @CheckResult from the support annotations?
@PaulWoitaschek I don't follow you.
What annotations are you referring to? The set of annotations from RxCache? And what kind of functionality @CheckResult
should add?
Check result is useful at places where the caller things calling a method resulted in a desired action like here.
You would apply the annotation to evict all and the ide will show a warning if you just called that method without subscribing. Also see https://developer.android.com/reference/android/support/annotation/CheckResult.html
That would be great. But ReactiveCache is a pure java module, so it's not possible to use any Type
from the Android SDK.
It's part of the support library and has an own artifact containing only the annotations
Extracted from the docs:
If you want to use annotations in a Gradle module that is not using the Android Plugin for Gradle (com.android.application or com.android.library) but is using the Gradle Java plugin instead, you must include the SDK repository explicitly because the Android support libraries are not available from the JCenter Java repository:
repositories {
jcenter()
maven { url '<your-SDK-path>/extras/android/m2repository' }
}
So, at least you know a way to detect dynamically the path to SDK, this will broke the build for everyone who wants to compile the library.
Hi @VictorAlbertos , evict/evictAll is not working for me.Any idea why?