Class CacheOptions


  • public class CacheOptions
    extends Object
    Cache options.
    • Field Detail

      • DEFAULT_MAX_SIZE

        public static final int DEFAULT_MAX_SIZE
        Default max size of the cache = 1000
        See Also:
        Constant Field Values
      • DEFAULT_NAME

        public static final String DEFAULT_NAME
        Actual name of anonymous shared cache = __vertx.DEFAULT
        See Also:
        Constant Field Values
      • DEFAULT_SHARED

        public static final boolean DEFAULT_SHARED
        Default shared cache = false
        See Also:
        Constant Field Values
    • Constructor Detail

      • CacheOptions

        public CacheOptions()
        Default constructor.
      • CacheOptions

        public CacheOptions​(CacheOptions other)
        Copy constructor.
        Parameters:
        other - the options to copy
      • CacheOptions

        public CacheOptions​(JsonObject json)
        Constructor to create an options from JSON.
        Parameters:
        json - the JSON
    • Method Detail

      • getMaxSize

        public int getMaxSize()
        Returns:
        the max number of entries the cache can hold.
      • setMaxSize

        public CacheOptions setMaxSize​(int maxSize)
        Set the max number of entries the cache can hold.
        Parameters:
        maxSize - the max size
        Returns:
        a reference to this, so the API can be used fluently
      • getName

        public String getName()
        Returns:
        the cache name used for sharing
      • setName

        public CacheOptions setName​(String name)
        Set the cache name, used when the cache is shared, otherwise ignored.
        Parameters:
        name - the new name
        Returns:
        a reference to this, so the API can be used fluently
      • isShared

        public boolean isShared()
        Returns:
        whether the cache is shared
      • setShared

        public CacheOptions setShared​(boolean shared)
        Set to true to share the cache.

        There can be multiple shared caches distinguished by getName(), when no specific name is set, the DEFAULT_NAME is used.

        Parameters:
        shared - true to use a shared client
        Returns:
        a reference to this, so the API can be used fluently
      • toJson

        public JsonObject toJson()
        Convert to JSON.
        Returns:
        the JSON