Package io.vertx.httpproxy.cache
Class CacheOptions
- java.lang.Object
-
- io.vertx.httpproxy.cache.CacheOptions
-
public class CacheOptions extends Object
Cache options.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_SIZEDefault max size of the cache = 1000static StringDEFAULT_NAMEActual name of anonymous shared cache =__vertx.DEFAULTstatic booleanDEFAULT_SHAREDDefault shared cache =false
-
Constructor Summary
Constructors Constructor Description CacheOptions()Default constructor.CacheOptions(JsonObject json)Constructor to create an options from JSON.CacheOptions(CacheOptions other)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxSize()StringgetName()booleanisShared()CacheOptionssetMaxSize(int maxSize)Set the max number of entries the cache can hold.CacheOptionssetName(String name)Set the cache name, used when the cache is shared, otherwise ignored.CacheOptionssetShared(boolean shared)Set totrueto share the cache.JsonObjecttoJson()Convert to JSON.StringtoString()
-
-
-
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 totrueto share the cache.There can be multiple shared caches distinguished by
getName(), when no specific name is set, theDEFAULT_NAMEis used.- Parameters:
shared-trueto 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
-
-