public class NearCacheConfig extends Object implements IdentifiedDataSerializable, Serializable, NamedConfig
| Modifier and Type | Class and Description |
|---|---|
static class |
NearCacheConfig.LocalUpdatePolicy
Defines how to reflect local updates to the Near Cache.
|
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_INVALIDATE_ON_CHANGE |
static NearCacheConfig.LocalUpdatePolicy |
DEFAULT_LOCAL_UPDATE_POLICY |
static int |
DEFAULT_MAX_IDLE_SECONDS
Default value of the maximum idle time for eviction in seconds.
|
static InMemoryFormat |
DEFAULT_MEMORY_FORMAT
Default value for the in-memory format.
|
static String |
DEFAULT_NAME
Default name when it is not set explicitly.
|
static boolean |
DEFAULT_SERIALIZE_KEYS
Do not serialize by default
|
static int |
DEFAULT_TTL_SECONDS
Default value of the time to live in seconds.
|
| Constructor and Description |
|---|
NearCacheConfig() |
NearCacheConfig(NearCacheConfig config) |
NearCacheConfig(String name) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
getClassId()
Returns type identifier for this class.
|
EvictionConfig |
getEvictionConfig()
Returns the eviction configuration for this Near Cache.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
InMemoryFormat |
getInMemoryFormat()
Returns the data type used to store entries.
|
NearCacheConfig.LocalUpdatePolicy |
getLocalUpdatePolicy()
Returns the
NearCacheConfig.LocalUpdatePolicy of this Near Cache. |
int |
getMaxIdleSeconds()
Returns the maximum number of seconds each entry can stay in the Near Cache as untouched (not-read).
|
String |
getName()
Returns the name of the Near Cache.
|
NearCachePreloaderConfig |
getPreloaderConfig()
Returns the
NearCachePreloaderConfig of this Near Cache. |
int |
getTimeToLiveSeconds()
Returns the maximum number of seconds for each entry to stay in the Near Cache (time to live).
|
int |
hashCode() |
boolean |
isCacheLocalEntries()
Checks if local entries are also cached in the Near Cache.
|
boolean |
isInvalidateOnChange()
Checks if Near Cache entries are invalidated when the entries in the backing data structure are changed
(updated or removed).
|
boolean |
isSerializeKeys()
Checks if the Near Cache key is stored in serialized format or by-reference.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
NearCacheConfig |
setCacheLocalEntries(boolean cacheLocalEntries)
Sets if local entries are also cached in the Near Cache.
|
NearCacheConfig |
setEvictionConfig(EvictionConfig evictionConfig)
Sets the eviction configuration for this Near Cache.
|
NearCacheConfig |
setInMemoryFormat(InMemoryFormat inMemoryFormat)
Sets the data type used to store entries.
|
NearCacheConfig |
setInMemoryFormat(String inMemoryFormat) |
NearCacheConfig |
setInvalidateOnChange(boolean invalidateOnChange)
Sets if Near Cache entries are invalidated when the entries in the backing data structure are changed
(updated or removed).
|
NearCacheConfig |
setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy localUpdatePolicy)
Sets the
NearCacheConfig.LocalUpdatePolicy of this Near Cache. |
NearCacheConfig |
setMaxIdleSeconds(int maxIdleSeconds)
Set the maximum number of seconds each entry can stay in the Near Cache as untouched (not-read).
|
NearCacheConfig |
setName(String name)
Sets the name of the Near Cache.
|
NearCacheConfig |
setPreloaderConfig(NearCachePreloaderConfig preloaderConfig)
Sets the
NearCachePreloaderConfig of this Near Cache. |
NearCacheConfig |
setSerializeKeys(boolean serializeKeys)
Sets if the Near Cache key is stored in serialized format or by-reference.
|
NearCacheConfig |
setTimeToLiveSeconds(int timeToLiveSeconds)
Returns the maximum number of seconds for each entry to stay in the Near Cache (time to live).
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public static final InMemoryFormat DEFAULT_MEMORY_FORMAT
public static final boolean DEFAULT_SERIALIZE_KEYS
public static final boolean DEFAULT_INVALIDATE_ON_CHANGE
public static final NearCacheConfig.LocalUpdatePolicy DEFAULT_LOCAL_UPDATE_POLICY
public static final int DEFAULT_TTL_SECONDS
public static final int DEFAULT_MAX_IDLE_SECONDS
public static final String DEFAULT_NAME
public NearCacheConfig()
public NearCacheConfig(String name)
public NearCacheConfig(NearCacheConfig config)
public String getName()
getName in interface NamedConfigpublic NearCacheConfig setName(String name)
setName in interface NamedConfigname - the name of the Near Cachepublic InMemoryFormat getInMemoryFormat()
Possible values:
BINARY: keys and values are stored as binary dataOBJECT: values are stored in their object formsNATIVE: keys and values are stored in native memoryBINARY.public NearCacheConfig setInMemoryFormat(InMemoryFormat inMemoryFormat)
Possible values:
BINARY: keys and values are stored as binary dataOBJECT: values are stored in their object formsNATIVE: keys and values are stored in native memoryBINARY.inMemoryFormat - the data type used to store entriespublic NearCacheConfig setInMemoryFormat(String inMemoryFormat)
public boolean isSerializeKeys()
NATIVE, this method will always return true.true if the key is stored in serialized format or in-memory-format is NATIVE,
false if the key is stored by-reference and in-memory-format is BINARY or OBJECTpublic NearCacheConfig setSerializeKeys(boolean serializeKeys)
NATIVE.
You can still set this value to false, but it will have no effect.serializeKeys - true if the key is stored in serialized format, false if stored by-referencepublic boolean isInvalidateOnChange()
When this setting is enabled, a Hazelcast instance with a Near Cache listens for cluster-wide changes on the entries of the backing data structure and invalidates its corresponding Near Cache entries. Changes done on the local Hazelcast instance always invalidate the Near Cache immediately.
true if Near Cache invalidations are enabled on changes, false otherwisepublic NearCacheConfig setInvalidateOnChange(boolean invalidateOnChange)
When this setting is enabled, a Hazelcast instance with a Near Cache listens for cluster-wide changes on the entries of the backing data structure and invalidates its corresponding Near Cache entries. Changes done on the local Hazelcast instance always invalidate the Near Cache immediately.
invalidateOnChange - true to enable Near Cache invalidations, false otherwisepublic int getTimeToLiveSeconds()
Entries that are older than timeToLiveSeconds will automatically be evicted from the Near Cache.
public NearCacheConfig setTimeToLiveSeconds(int timeToLiveSeconds)
Entries that are older than timeToLiveSeconds will automatically be evicted from the Near Cache.
Accepts any integer between 0 and Integer.MAX_VALUE.
The value 0 means Integer.MAX_VALUE.
The default is 0.
timeToLiveSeconds - the maximum number of seconds for each entry to stay in the Near Cachepublic int getMaxIdleSeconds()
Entries that are not read (touched) more than maxIdleSeconds value will get removed from the Near Cache.
public NearCacheConfig setMaxIdleSeconds(int maxIdleSeconds)
Entries that are not read (touched) more than maxIdleSeconds value will get removed from the Near Cache.
Accepts any integer between 0 and Integer.MAX_VALUE.
The value 0 means Integer.MAX_VALUE.
The default is 0.
maxIdleSeconds - maximum number of seconds each entry can stay in the Near Cache as untouched (not-read)public EvictionConfig getEvictionConfig()
public NearCacheConfig setEvictionConfig(EvictionConfig evictionConfig)
evictionConfig - the eviction configurationpublic boolean isCacheLocalEntries()
This is useful when the in-memory format of the Near Cache is different from the backing data structure. This setting has no meaning on Hazelcast clients, since they have no local entries.
true if local entries are also cached, false otherwisepublic NearCacheConfig setCacheLocalEntries(boolean cacheLocalEntries)
This is useful when the in-memory format of the Near Cache is different from the backing data structure. This setting has no meaning on Hazelcast clients, since they have no local entries.
cacheLocalEntries - true if local entries are also cached, false otherwisepublic NearCacheConfig.LocalUpdatePolicy getLocalUpdatePolicy()
NearCacheConfig.LocalUpdatePolicy of this Near Cache.NearCacheConfig.LocalUpdatePolicy of this Near Cachepublic NearCacheConfig setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy localUpdatePolicy)
NearCacheConfig.LocalUpdatePolicy of this Near Cache.
This is only implemented for JCache data structures.
localUpdatePolicy - the NearCacheConfig.LocalUpdatePolicy of this Near Cachepublic NearCachePreloaderConfig getPreloaderConfig()
NearCachePreloaderConfig of this Near Cache.NearCachePreloaderConfig of this Near Cachepublic NearCacheConfig setPreloaderConfig(NearCachePreloaderConfig preloaderConfig)
NearCachePreloaderConfig of this Near Cache.preloaderConfig - the NearCachePreloaderConfig of this Near Cachepublic int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getClassId()
IdentifiedDataSerializablegetClassId in interface IdentifiedDataSerializablepublic void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - outputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializablereadData in interface DataSerializablein - inputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
input stream has been closed.Copyright © 2022 Hazelcast, Inc.. All rights reserved.