Class FeatureCache


  • public class FeatureCache
    extends Object
    Feature Row Cache for a single feature table
    Since:
    3.2.0
    Author:
    osbornb
    • Field Detail

      • DEFAULT_CACHE_MAX_SIZE

        public static final int DEFAULT_CACHE_MAX_SIZE
        Default max number of feature rows to retain in cache
        See Also:
        Constant Field Values
    • Constructor Detail

      • FeatureCache

        public FeatureCache​(int size)
        Constructor
        Parameters:
        size - max feature rows to retain in the cache
    • Method Detail

      • getMaxSize

        public int getMaxSize()
        Get the cache max size
        Returns:
        max size
      • getSize

        public int getSize()
        Get the current cache size, number of feature rows cached
        Returns:
        cache size
      • get

        public FeatureRow get​(long featureId)
        Get the cached feature row by feature id
        Parameters:
        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​(long featureId)
        Remove the cached feature row by id
        Parameters:
        featureId - feature row id
        Returns:
        removed feature row or null
      • clear

        public void clear()
        Clear the cache
      • resize

        public void resize​(int maxSize)
        Resize the cache
        Parameters:
        maxSize - max size
      • clearAndResize

        public void clearAndResize​(int maxSize)
        Clear and resize the cache
        Parameters:
        maxSize - max size of the cache