com.vaadin.client.data
Class CacheStrategy.DefaultCacheStrategy

java.lang.Object
  extended by com.vaadin.client.data.CacheStrategy.AbstractBasicSymmetricalCacheStrategy
      extended by 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 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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.client.data.CacheStrategy
CacheStrategy.AbstractBasicSymmetricalCacheStrategy, CacheStrategy.DefaultCacheStrategy
 
Constructor Summary
CacheStrategy.DefaultCacheStrategy()
          Creates a DefaultCacheStrategy keeping between 3 and 4 pages worth of data cached both before and after the active range.
CacheStrategy.DefaultCacheStrategy(int minimumRatio, int maximumRatio)
          Creates a DefaultCacheStrategy with custom ratios for how much data to cache.
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheStrategy.DefaultCacheStrategy

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


CacheStrategy.DefaultCacheStrategy

public CacheStrategy.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
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 class CacheStrategy.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 class CacheStrategy.AbstractBasicSymmetricalCacheStrategy
Parameters:
pageSize - the current number of items used at once
Returns:
maximum of items to cache


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.