Class ListPaginatorWithSimpleCache<T>

java.lang.Object
org.aksw.commons.util.delegate.AbstractDelegated<RangedSupplier<Long,T>>
org.aksw.commons.rx.range.RangedSupplierDelegated<Long,T>
org.aksw.commons.rx.cache.range.ListPaginatorWithSimpleCache<T>
All Implemented Interfaces:
Function<com.google.common.collect.Range<Long>,io.reactivex.rxjava3.core.Flowable<T>>, ListPaginator<T>, RangedSupplier<Long,T>, org.aksw.commons.util.delegate.Delegated<RangedSupplier<Long,T>>, org.aksw.commons.util.delegate.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 Summary

    Fields
    Modifier and Type
    Field
    Description
    protected io.reactivex.rxjava3.core.Single<List<T>>
     

    Fields inherited from class org.aksw.commons.util.delegate.AbstractDelegated

    delegate
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.reactivex.rxjava3.core.Flowable<T>
    apply(com.google.common.collect.Range<Long> range)
     
    io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>>
    fetchCount(Long itemLimit, Long rowLimit)
     
    static <V> ListPaginator<V>
    wrap(ListPaginator<V> backend)
     

    Methods inherited from class org.aksw.commons.util.delegate.AbstractDelegated

    delegate, equals, hashCode, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface org.aksw.commons.rx.lookup.ListPaginator

    batch, fetchList, map

    Methods inherited from interface org.aksw.commons.util.delegate.Unwrappable

    unwrap
  • 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)