Package mil.nga.geopackage.features.user
Class FeatureCacheTables
- java.lang.Object
-
- mil.nga.geopackage.features.user.FeatureCacheTables
-
public class FeatureCacheTables extends Object
Feature Row Cache for multiple feature tables in a single GeoPackage- Since:
- 3.2.0
- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description FeatureCacheTables()
Constructor, created with cache size ofFeatureCache.DEFAULT_CACHE_MAX_SIZE
FeatureCacheTables(int maxCacheSize)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all cachesvoid
clear(String tableName)
Clear the feature table cachevoid
clearAndResize(int maxCacheSize)
Clear and resize all caches and update the max cache sizevoid
clearAndResize(String tableName, int maxCacheSize)
Clear and resize the feature table cacheFeatureRow
get(String tableName, long featureId)
Get the cached feature row by table name and feature idFeatureCache
getCache(String tableName)
Get or create a feature row cache for the table nameFeatureCache
getCache(FeatureRow featureRow)
Get or create a feature row cache for the feature rowint
getMaxCacheSize()
Get the max cache size used when creating new feature row cachesint
getMaxSize(String tableName)
Get the cache max size for the table nameint
getSize(String tableName)
Get the current cache size, number of feature rows cached, for the table nameSet<String>
getTables()
Get the feature table names with a feature row cacheFeatureRow
put(FeatureRow featureRow)
Cache the feature rowFeatureRow
remove(String tableName, long featureId)
Remove the cached feature row by idFeatureRow
remove(FeatureRow featureRow)
Remove the cached feature rowvoid
resize(int maxCacheSize)
Resize all caches and update the max cache sizevoid
resize(String tableName, int maxCacheSize)
Resize the feature table cachevoid
setMaxCacheSize(int maxCacheSize)
Set the max cache size to use when creating new feature row caches
-
-
-
Constructor Detail
-
FeatureCacheTables
public FeatureCacheTables()
Constructor, created with cache size ofFeatureCache.DEFAULT_CACHE_MAX_SIZE
-
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 namefeatureId
- 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 namefeatureId
- 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 namemaxCacheSize
- 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 namemaxCacheSize
- 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
-
-