Class ListPaginatorWithSimpleCache<T>

All Implemented Interfaces:
Function<com.google.common.collect.Range<Long>,io.reactivex.rxjava3.core.Flowable<T>>, ListPaginator<T>, RangedSupplier<Long,T>, Delegated<RangedSupplier<Long,T>>, Unwrappable

public class ListPaginatorWithSimpleCache<T> extends RangedSupplierDelegated<Long,T> implements ListPaginator<T>
A cache that upon any item or count request caches the full range of data into a (java) List and subsequently serves the request from the cache. This class performs only at most a single request to the delegate's apply method.
Author:
raven
  • Field Details

    • cache

      protected io.reactivex.rxjava3.core.Single<List<T>> cache
  • Constructor Details

    • ListPaginatorWithSimpleCache

      public ListPaginatorWithSimpleCache(RangedSupplier<Long,T> delegate)
  • Method Details

    • fetchCount

      public io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>> fetchCount(Long itemLimit, Long rowLimit)
      Specified by:
      fetchCount in interface ListPaginator<T>
      Parameters:
      itemLimit - This argument is ignored
      rowLimit - This argument is Ignored
    • apply

      public io.reactivex.rxjava3.core.Flowable<T> apply(com.google.common.collect.Range<Long> range)
      Specified by:
      apply in interface Function<com.google.common.collect.Range<Long>,io.reactivex.rxjava3.core.Flowable<T>>
      Overrides:
      apply in class RangedSupplierDelegated<Long,T>
    • wrap

      public static <V> ListPaginator<V> wrap(ListPaginator<V> backend)