RxJava has become a standard in Android development. It’s great until you have to deal with Android lifecycle. Normally you unsubscribe when view is destroyed and create new Observable after view is recreated. It’s ok in most cases but sometimes there are actions, which cannot be done more than once i.e. HTTP Request which must be done once and Resposne must be received. In that cases Observables must be kept in place which lifecyle is different than destroyed view. This is where ObservableCache can be used. Library allows to cache Observable in global singleton map and retrieve same Observable after view is recreated. Internally library uses cache() for caching. Observables are automatically removed after onComplete.


(adsbygoogle = window.adsbygoogle || []).push({});