use of io.victoralbertos.jolyglot.GsonSpeaker in project MVPArms by JessYanCoding.
the class ClientModule method provideRxCache.
/**
* 提供 {@link RxCache}
*
* @param application {@link Application}
* @param configuration {@link RxCacheConfiguration}
* @param cacheDirectory RxCache 缓存路径
* @param gson {@link Gson}
* @return {@link RxCache}
*/
@Singleton
@Provides
static RxCache provideRxCache(Application application, @Nullable RxCacheConfiguration configuration, @Named("RxCacheDirectory") File cacheDirectory, Gson gson) {
RxCache.Builder builder = new RxCache.Builder();
RxCache rxCache = null;
if (configuration != null) {
rxCache = configuration.configRxCache(application, builder);
}
if (rxCache != null) {
return rxCache;
}
return builder.persistence(cacheDirectory, new GsonSpeaker(gson));
}
Aggregations