Class CacheStrategy.DefaultCacheStrategy

  • All Implemented Interfaces:
    CacheStrategy
    Enclosing interface:
    CacheStrategy

    public static class CacheStrategy.DefaultCacheStrategy
    extends CacheStrategy.AbstractBasicSymmetricalCacheStrategy
    The default cache strategy used by AbstractRemoteDataSource, using multiples of the page size for determining the minimum and maximum number of items to keep in the cache. By default, at least three times the page size both before and after the currently used range are kept in the cache and items are discarded if there's yet another page size worth of items cached in either direction.
    • Constructor Detail

      • DefaultCacheStrategy

        public DefaultCacheStrategy()
        Creates a DefaultCacheStrategy keeping between 3 and 4 pages worth of data cached both before and after the active range.
      • DefaultCacheStrategy

        public DefaultCacheStrategy​(int minimumRatio,
                                    int maximumRatio)
        Creates a DefaultCacheStrategy with custom ratios for how much data to cache. The ratios denote how many multiples of the currently used page size are kept in the cache in each direction.
        Parameters:
        minimumRatio - the minimum number of pages to keep in the cache in each direction
        maximumRatio - the maximum number of pages to keep in the cache in each direction