com.vaadin.client.data.

Interface CacheStrategy

    • Method Summary

      All Methods
      Modifier and Type Method Description
      Range getMaxCacheRange​(Range displayedRange, Range cachedRange, Range estimatedAvailableRange)

      Gets the maximum row range that should be cached.

      Range getMinCacheRange​(Range displayedRange, Range cachedRange, Range estimatedAvailableRange)

      Gets the minimum row range that should be cached.

      void onDataArrive​(double roundTripTime, int rowCount)

      Called whenever data requested by the data source has arrived.

    • Method Detail

      • onDataArrive

        void onDataArrive​(double roundTripTime,
                          int rowCount)

        Called whenever data requested by the data source has arrived. This information can e.g. be used for measuring how long it takes to fetch different number of rows from the server.

        A cache strategy implementation cannot use this information to keep track of which items are in the cache since the data source might discard items without notifying the cache strategy.

        Parameters:

        roundTripTime - the total number of milliseconds elapsed from requesting the data until the response was passed to the data source

        rowCount - the number of received rows

      • getMinCacheRange

        Range getMinCacheRange​(Range displayedRange,
                               Range cachedRange,
                               Range estimatedAvailableRange)

        Gets the minimum row range that should be cached. The data source will fetch new data if the currently cached range does not fill the entire minimum cache range.

        Parameters:

        displayedRange - the range of currently displayed rows

        cachedRange - the range of currently cached rows

        estimatedAvailableRange - the estimated range of rows available for the data source

        Returns:

        the minimum range of rows that should be cached, should at least include the displayed range and should not exceed the total estimated available range

      • getMaxCacheRange

        Range getMaxCacheRange​(Range displayedRange,
                               Range cachedRange,
                               Range estimatedAvailableRange)

        Gets the maximum row range that should be cached. The data source will discard cached rows that are outside the maximum range.

        Parameters:

        displayedRange - the range of currently displayed rows

        cachedRange - the range of currently cached rows

        estimatedAvailableRange - the estimated range of rows available for the data source

        Returns:

        the maximum range of rows that should be cached, should at least include the displayed range and should not exceed the total estimated available range