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_SIZEFeatureCacheTables(int maxCacheSize)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all cachesvoidclear(String tableName)Clear the feature table cachevoidclearAndResize(int maxCacheSize)Clear and resize all caches and update the max cache sizevoidclearAndResize(String tableName, int maxCacheSize)Clear and resize the feature table cacheFeatureRowget(String tableName, long featureId)Get the cached feature row by table name and feature idFeatureCachegetCache(String tableName)Get or create a feature row cache for the table nameFeatureCachegetCache(FeatureRow featureRow)Get or create a feature row cache for the feature rowintgetMaxCacheSize()Get the max cache size used when creating new feature row cachesintgetMaxSize(String tableName)Get the cache max size for the table nameintgetSize(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 cacheFeatureRowput(FeatureRow featureRow)Cache the feature rowFeatureRowremove(String tableName, long featureId)Remove the cached feature row by idFeatureRowremove(FeatureRow featureRow)Remove the cached feature rowvoidresize(int maxCacheSize)Resize all caches and update the max cache sizevoidresize(String tableName, int maxCacheSize)Resize the feature table cachevoidsetMaxCacheSize(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
-
-