Package com.vaadin.client.data
Class CacheStrategy.DefaultCacheStrategy
- java.lang.Object
-
- com.vaadin.client.data.CacheStrategy.AbstractBasicSymmetricalCacheStrategy
-
- com.vaadin.client.data.CacheStrategy.DefaultCacheStrategy
-
- All Implemented Interfaces:
CacheStrategy
- Enclosing interface:
- CacheStrategy
public static class CacheStrategy.DefaultCacheStrategy extends CacheStrategy.AbstractBasicSymmetricalCacheStrategy
The default cache strategy used byAbstractRemoteDataSource
, 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.client.data.CacheStrategy
CacheStrategy.AbstractBasicSymmetricalCacheStrategy, CacheStrategy.DefaultCacheStrategy
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.vaadin.client.data.CacheStrategy.AbstractBasicSymmetricalCacheStrategy
getMaxCacheRange, getMinCacheRange, onDataArrive
-
-
-
-
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 directionmaximumRatio
- the maximum number of pages to keep in the cache in each direction
-
-
Method Detail
-
getMinimumCacheSize
public int getMinimumCacheSize(int pageSize)
Description copied from class:CacheStrategy.AbstractBasicSymmetricalCacheStrategy
Gets the the minimum number of extra items to cache in one direction.- Specified by:
getMinimumCacheSize
in classCacheStrategy.AbstractBasicSymmetricalCacheStrategy
- Parameters:
pageSize
- the current number of items used at once- Returns:
- minimum number of items to cache
-
getMaximumCacheSize
public int getMaximumCacheSize(int pageSize)
Description copied from class:CacheStrategy.AbstractBasicSymmetricalCacheStrategy
Gets the maximum number of extra items to cache in one direction.- Specified by:
getMaximumCacheSize
in classCacheStrategy.AbstractBasicSymmetricalCacheStrategy
- Parameters:
pageSize
- the current number of items used at once- Returns:
- maximum of items to cache
-
-