public static class CacheStrategy.DefaultCacheStrategy extends CacheStrategy.AbstractBasicSymmetricalCacheStrategy
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.CacheStrategy.AbstractBasicSymmetricalCacheStrategy, CacheStrategy.DefaultCacheStrategy| Constructor and Description |
|---|
DefaultCacheStrategy()
Creates a DefaultCacheStrategy keeping between 3 and 4 pages worth of
data cached both before and after the active range.
|
DefaultCacheStrategy(int minimumRatio,
int maximumRatio)
Creates a DefaultCacheStrategy with custom ratios for how much data
to cache.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMaximumCacheSize(int pageSize)
Gets the maximum number of extra items to cache in one direction.
|
int |
getMinimumCacheSize(int pageSize)
Gets the the minimum number of extra items to cache in one direction.
|
getMaxCacheRange, getMinCacheRange, onDataArrivepublic DefaultCacheStrategy()
public DefaultCacheStrategy(int minimumRatio,
int maximumRatio)
minimumRatio - the minimum number of pages to keep in the cache in each
directionmaximumRatio - the maximum number of pages to keep in the cache in each
directionpublic int getMinimumCacheSize(int pageSize)
CacheStrategy.AbstractBasicSymmetricalCacheStrategygetMinimumCacheSize in class CacheStrategy.AbstractBasicSymmetricalCacheStrategypageSize - the current number of items used at oncepublic int getMaximumCacheSize(int pageSize)
CacheStrategy.AbstractBasicSymmetricalCacheStrategygetMaximumCacheSize in class CacheStrategy.AbstractBasicSymmetricalCacheStrategypageSize - the current number of items used at onceCopyright © 2023 Vaadin Ltd. All rights reserved.