code: public static <T> Flowable<T> cache(final Flowable<T> source, final long duration,
              final TimeUnit unit, final Scheduler.Worker worker) {
          final AtomicReference<CachedFlowable<T>> cacheRef = new AtomicReference<CachedFlowable<T>>();
          CachedFlowable<T> cache = new CachedFlowable<T>(source);
          cacheRef.set(cache);
          return cache.doOnSubscribe(new Consumer<Subscription>() {
              @Override
              public void accept(Subscription d) {
                  Runnable action = new Runnable() {
                      @Override
                      public void run() {
                          cacheRef.get().reset();
                      }
                  };
                  worker.schedule(action, duration, unit);
              }
          });
      }
docs: Returns a cached {@link Flowable} like {@link Flowable#cache()} except that
  the cache can be reset by calling {@link CachedFlowable#reset()} and the
  cache will be automatically reset an interval after first subscription (or
  first subscription after reset). The interval is defined by {@code duration}
  and {@code unit} .
  
  @param source
  the source observable
  @param duration
  duration till next reset
  @param unit
  units corresponding to the duration
  @param worker
  worker to use for scheduling reset. Don't forget to unsubscribe
  the worker when no longer required.
  @param <T>
  the generic type of the source
  @return cached observable that resets regularly on a time interval