Class FeatureCacheTables


  • public class FeatureCacheTables
    extends Object
    Feature Row Cache for multiple feature tables in a single GeoPackage
    Since:
    3.2.0
    Author:
    osbornb
    • Constructor Detail

      • FeatureCacheTables

        public FeatureCacheTables​(int maxCacheSize)
        Constructor
        Parameters:
        maxCacheSize - max feature rows to retain in each feature table cache
    • Method Detail

      • getMaxCacheSize

        public int getMaxCacheSize()
        Get the max cache size used when creating new feature row caches
        Returns:
        max cache size
      • setMaxCacheSize

        public void setMaxCacheSize​(int maxCacheSize)
        Set the max cache size to use when creating new feature row caches
        Parameters:
        maxCacheSize - feature row max cache size
      • getTables

        public Set<String> getTables()
        Get the feature table names with a feature row cache
        Returns:
        feature table names
      • getCache

        public FeatureCache getCache​(String tableName)
        Get or create a feature row cache for the table name
        Parameters:
        tableName - feature table name
        Returns:
        feature row cache
      • getCache

        public FeatureCache getCache​(FeatureRow featureRow)
        Get or create a feature row cache for the feature row
        Parameters:
        featureRow - feature row
        Returns:
        feature row cache
      • getMaxSize

        public int getMaxSize​(String tableName)
        Get the cache max size for the table name
        Parameters:
        tableName - feature table name
        Returns:
        max size
      • getSize

        public int getSize​(String tableName)
        Get the current cache size, number of feature rows cached, for the table name
        Parameters:
        tableName - feature table name
        Returns:
        cache size
      • get

        public FeatureRow get​(String tableName,
                              long featureId)
        Get the cached feature row by table name and feature id
        Parameters:
        tableName - feature table name
        featureId - feature row id
        Returns:
        feature row or null
      • put

        public FeatureRow put​(FeatureRow featureRow)
        Cache the feature row
        Parameters:
        featureRow - feature row
        Returns:
        previous cached feature row or null
      • remove

        public FeatureRow remove​(FeatureRow featureRow)
        Remove the cached feature row
        Parameters:
        featureRow - feature row
        Returns:
        removed feature row or null
      • remove

        public FeatureRow remove​(String tableName,
                                 long featureId)
        Remove the cached feature row by id
        Parameters:
        tableName - feature table name
        featureId - feature row id
        Returns:
        removed feature row or null
      • clear

        public void clear​(String tableName)
        Clear the feature table cache
        Parameters:
        tableName - feature table name
      • clear

        public void clear()
        Clear all caches
      • resize

        public void resize​(String tableName,
                           int maxCacheSize)
        Resize the feature table cache
        Parameters:
        tableName - feature table name
        maxCacheSize - max cache size
      • resize

        public void resize​(int maxCacheSize)
        Resize all caches and update the max cache size
        Parameters:
        maxCacheSize - max cache size
      • clearAndResize

        public void clearAndResize​(String tableName,
                                   int maxCacheSize)
        Clear and resize the feature table cache
        Parameters:
        tableName - feature table name
        maxCacheSize - max cache size
      • clearAndResize

        public void clearAndResize​(int maxCacheSize)
        Clear and resize all caches and update the max cache size
        Parameters:
        maxCacheSize - max cache size