CacheAttributes has the Cache configuration information. It is a structure
which is passed to Cache.init(CacheAttributes) to do the system wide
configuration. All the fileds are public and user can access the fields
directly.
Two constructors and a set of convenient methods are provided.
capacityBuffer
The percentage of the cache to keep in reserve when determining when to
clean the cache.
java.lang.String
capacityPolicy
The capacityPolicy object which is used to determine if an object is
eligible to be removed from the cache when the cache capacity has
been reached.
int
cleanInterval
Number of seconds between cache cleanings
java.lang.String
diskPath
Absolute path to the the root of the disk cache directory
CacheAttributes()
Constructs a default CacheAttributes which will set all the
values to default.
Method Summary
void
addCacheAddr(java.net.InetAddress ipAddr,
int port)
adds a new ipAddr/port to the list of cache addresses
void
addCacheAddr(java.net.InetAddress ipAddr,
int port,
boolean replace)
adds a new ipAddr/port to the list of cache addresses
void
addCacheAddr(java.net.InetAddress ipAddr,
int port,
boolean replace,
boolean isOriginal)
adds a new ipAddr/port to the list of cache addresses
void
addCacheAddr(java.net.InetAddress ipAddr,
int port,
boolean replace,
boolean isOriginal,
int order)
adds a new ipAddr/port to the list of cache addresses
void
addPrimaryCacheAddr(java.net.InetAddress ipAddr,
int port)
adds a new ipAddr/port to the list of cache addresses
boolean
addressIsOriginal(java.net.InetAddress ipAddr,
int port)
returns true if the ipAddr/port is on the list and is the original address
java.util.Vector
getAddrList()
gets the list of cache cache addresses, if the list is null
set to the default
java.lang.String
getAddrListString()
Returns the list of cache addresses in a formatted string,
if the list is null, set to the default
java.lang.String
getAddrString()
Returns all the ip:port discovery addresses in a String
This differs from getAddrListString in that it only returns the ip:port
It doesn't include other information about the port or formatting.
java.util.Enumeration
getCacheAddrs()
gets an enumeration of the list of cache addresses, if the list
is null the enumerator will return the default address.
oracle.ias.cache.CacheAddress[]
getCoordinatorList()
gets the list of cache cache addresses, if the list is null
set to the default
java.lang.String
getLocalAddress()
Gets the specified localhost IP address for the listener to bind to
int
getLowerPortBoundry()
Get the lowest allowed port number in which the server socket would bind
to.
java.lang.String
getMulticastAddress()
Get the multicast address for broadcasting coordinator address
int
getMulticastInterval()
Get the length of the period for broadcasting coordinator address
int
getMulticastPort()
Get the multicast port number for broadcasting coordinator address
int
getMulticastTTL()
Get the TTL settings for the multicast socket
setCacheName(java.lang.String name)
sets the cach name
void
setCapacityBuffer(int count)
sets the capacity buffer the percent of the cache capacity to try to hold in reserve
void
setCapacityPolicy(java.lang.String policyString)
sets the capacity policy string
The capacity policy string must be the class name for a class that
extends the CapacityPolicy abstract class and implements the Declarable
interface.
void
setCleanInterval(int pCleanInterval)
sets number of seconds between cache cleanings
void
setDiskPath(java.lang.String pDiskPath)
sets absolute path to the root
of the disk cache directory.
void
setDiskSize(int pDiskSize)
sets the disk cache size
void
setDistribute(boolean pDistribute)
sets the distribute flag to indicate if the cache
is local to the process of not
void
setEnableSSL(boolean enable)
enable or disable SSL support for distribute cache
void
setKeyStore(java.lang.String name)
Sets the key store location
void
setLocalAddress(java.lang.String addr)
Specifies the localhost IP address for the listener to bind to
void
setLogFileName(java.lang.String pLogFileName)
sets the log file name for the
DefaultCacheLogger.
void
setLogger(java.lang.String pLogger)
sets the logger object which will be used
to log cache messages.
void
setLogSeverity(int severity)
sets the log severity which determines which log messages are published
to the log
void
setLowerPortBoundry(int port)
Set the lowest allowed port number in which the server socket would bind
to.
void
setMaxObjects(int pMaxObjects)
sets the maximum number of in-memory objects
in the cache.
void
setMaxSize(int pMaxSize)
sets the maximum number of bytes available to the in-memory cache
Indicates the cache is distributed, updates and invalidates are propagated
to other caches in the system
version
public java.lang.String version
Version of the cache software
maxObjects
public int maxObjects
Maximum number of in-memory objects in the cache
maxSize
public int maxSize
The size of the memory cache in megabytes
diskSize
public int diskSize
The size of the disk cache in megabytes
diskPath
public java.lang.String diskPath
Absolute path to the the root of the disk cache directory
cleanInterval
public int cleanInterval
Number of seconds between cache cleanings
pingInterval
public int pingInterval
Number of seconds between cache death detection(pinging)
logger
public java.lang.String logger
The logger object which is used to log cache messages.
logFileName
public java.lang.String logFileName
Log file name for the default logger implementation.
logSeverity
public int logSeverity
Log severity, see CacheLogger for details
capacityPolicy
public java.lang.String capacityPolicy
The capacityPolicy object which is used to determine if an object is
eligible to be removed from the cache when the cache capacity has
been reached.
The capacity buffer is a percentage of the cache to be held in reserve.
That is, the cache system will start looking for objects to be removed
from the cache when only the indicated percentage of the cache is
available. For example if maxCount is set to 1000 and the capacityBuffer
is set to 5 then when the number of objects in the cache reaches 950, the
cache will start looking for objects to remove.
The default value for capacityBuffer is 15.
capacityBuffer
public int capacityBuffer
The percentage of the cache to keep in reserve when determining when to
clean the cache.
maxIdleTime
public int maxIdleTime
The maximum number of seconds an object can remain idle without being
available for removal should the cache fill up
transport
public int transport
Transport protocol being used when distribute mode is set.
isSSLEnabled
public boolean isSSLEnabled
Use SSL in the transport protocol
keyStoreLocation
public java.lang.String keyStoreLocation
Absolute path to the key store
sslConfigFilePath
public java.lang.String sslConfigFilePath
Absolute to the SSL configuration file
localAddress
public java.lang.String localAddress
Local host IP address which may not be the primary address
Constructs a default CacheAttributes which will set all the
values to default.
The default values are as following:
distribute = false
version = 2.0.0
maxObjects = 5000
diskSize = 10M
diskPath = null when diskPath is null, disk caching is disabled.
cleanInterval = 60 seconds
pingInterval = 60 seconds
logger will be DefaultCacheLogger
the default log file name for DefaultCacheLogger is javacache.log
the default cache address is localHost with port 12345
Since:
2.0.0
Method Detail
setDistribute
public void setDistribute(boolean pDistribute)
sets the distribute flag to indicate if the cache
is local to the process of not
Parameters:
pDistribute - is true, means the cache is part of the distributed
cache otherwise, the cache is local to the process.
Since:
2.0.0
setMaxObjects
public void setMaxObjects(int pMaxObjects)
sets the maximum number of in-memory objects
in the cache.
Parameters:
pMaxObjects - maximum number of in-memory objects in the cache
Since:
2.0.0
setMaxSize
public void setMaxSize(int pMaxSize)
sets the maximum number of bytes available to the in-memory cache
Since:
2.1.1
setDiskSize
public void setDiskSize(int pDiskSize)
sets the disk cache size
Parameters:
pDiskSize - the disk cache size in megabytes
Since:
2.0.0
setDiskPath
public void setDiskPath(java.lang.String pDiskPath)
sets absolute path to the root
of the disk cache directory.
Parameters:
pDiskPath - the absolute path to the root of the disk cache directory
Since:
2.0.0
setCleanInterval
public void setCleanInterval(int pCleanInterval)
sets number of seconds between cache cleanings
Parameters:
pCleanInterval - number of seconds between cache cleanings
Since:
2.0.0
setPingInterval
public void setPingInterval(int pPingInterval)
sets number of seconds between cache death detection
Parameters:
pPingInterval - number of seconds between cache death detection
Since:
2.0.0
setLogger
public void setLogger(java.lang.String pLogger)
sets the logger object which will be used
to log cache messages.
Parameters:
pLogger - an object extends CacheLogger
Since:
2.0.0
setLogSeverity
public void setLogSeverity(int severity)
sets the log severity which determines which log messages are published
to the log
Parameters:
severity - log severity
Since:
2.1.1
setLogFileName
public void setLogFileName(java.lang.String pLogFileName)
sets the log file name for the
DefaultCacheLogger.
Parameters:
pLogFileName - the log file name for the DefaultCacheLogger.
Since:
2.0.0
setCapacityPolicy
public void setCapacityPolicy(java.lang.String policyString)
sets the capacity policy string
The capacity policy string must be the class name for a class that
extends the CapacityPolicy abstract class and implements the Declarable
interface. The abstract method CapacityPolicy.policy must be implemented.
The capacity policy set in CacheAttributes is the capacity policy for
the cache as a whole. The init method of
the Declarable interface is called when the object is instantiated to do
any initialization required.
Parameters:
policyString - the class name of the capacity policy object
Since:
9.0.4
setAutoInit
public void setAutoInit(boolean flag)
Parameters:
flag - if true auto init is enabled
Since:
9.0.4
setCacheName
public void setCacheName(java.lang.String name)
sets the cach name
Since:
2.0.0
setKeyStore
public void setKeyStore(java.lang.String name)
Sets the key store location
setSSLConfigFile
public void setSSLConfigFile(java.lang.String name)
Sets the SSL configuration file location
setEnableSSL
public void setEnableSSL(boolean enable)
enable or disable SSL support for distribute cache
setTransport
public void setTransport(int mode)
Specifies the transport protocol when distribute mode is set
setLocalAddress
public void setLocalAddress(java.lang.String addr)
Specifies the localhost IP address for the listener to bind to
public void addCacheAddr(java.net.InetAddress ipAddr,
int port)
adds a new ipAddr/port to the list of cache addresses
Parameters:
ipAddr - the inet address
port - the port
Since:
2.0.0
addCacheAddr
public void addCacheAddr(java.net.InetAddress ipAddr,
int port,
boolean replace)
adds a new ipAddr/port to the list of cache addresses
Parameters:
ipAddr - the inet address
port - the port
replace - if the IP address already exists. The previous address
would be discarded.
Since:
2.0.0
addCacheAddr
public void addCacheAddr(java.net.InetAddress ipAddr,
int port,
boolean replace,
boolean isOriginal)
adds a new ipAddr/port to the list of cache addresses
Parameters:
ipAddr - the inet address
port - the port
replace - if the IP address already exists. The previous address
would be discarded.
isOriginal -
Since:
9.0.4
addCacheAddr
public void addCacheAddr(java.net.InetAddress ipAddr,
int port,
boolean replace,
boolean isOriginal,
int order)
adds a new ipAddr/port to the list of cache addresses
Parameters:
ipAddr - the inet address
port - the port
replace - if the IP address already exists. The previous address
would be discarded.
isOriginal -
order - for discoverer priority
Since:
9.0.4
addPrimaryCacheAddr
public void addPrimaryCacheAddr(java.net.InetAddress ipAddr,
int port)
adds a new ipAddr/port to the list of cache addresses
Parameters:
ipAddr - the inet address
port - the port
Since:
9.0.4
addressIsOriginal
public boolean addressIsOriginal(java.net.InetAddress ipAddr,
int port)
returns true if the ipAddr/port is on the list and is the original address
Parameters:
ipAddr - the inet address
port - the port
Returns:
true if the ipAddr/port is on the list and is the original
address false otherwise
Since:
9.0.4
removeCacheAddr
public boolean removeCacheAddr(java.net.InetAddress ipAddr,
int port)
remove an existing ipAddr/port from the list of cache addresses
Parameters:
ipAddr - the inet address
port - the port
Since:
9.0.4
getCacheAddrs
public java.util.Enumeration getCacheAddrs()
gets an enumeration of the list of cache addresses, if the list
is null the enumerator will return the default address.
Since:
2.0.0
getCoordinatorList
public oracle.ias.cache.CacheAddress[] getCoordinatorList()
gets the list of cache cache addresses, if the list is null
set to the default
Since:
9.0.4
getAddrList
public java.util.Vector getAddrList()
gets the list of cache cache addresses, if the list is null
set to the default
Since:
2.0.0
getAddrListString
public java.lang.String getAddrListString()
Returns the list of cache addresses in a formatted string,
if the list is null, set to the default
Since:
2.0.1
getAddrString
public java.lang.String getAddrString()
Returns all the ip:port discovery addresses in a String
This differs from getAddrListString in that it only returns the ip:port
It doesn't include other information about the port or formatting.
if the list is null, return the default ip:port
Since:
9.0.4
getLocalAddress
public java.lang.String getLocalAddress()
Gets the specified localhost IP address for the listener to bind to
isNodeListenerDeathDetectable
public boolean isNodeListenerDeathDetectable()
Death detection for local Node Listener for coordinator discovery process
setNodeListenerDeathDetectable
public void setNodeListenerDeathDetectable(boolean detect)
Enable death detection for local Node Listener
setOverrideNodeListenerPort
public void setOverrideNodeListenerPort(int port)
Force the Node Listener to listen on a specific port
getOverrideNodeListenerPort
public int getOverrideNodeListenerPort()
Get the override Node Listener port number if it is set
getMulticastAddress
public java.lang.String getMulticastAddress()
Get the multicast address for broadcasting coordinator address
getMulticastPort
public int getMulticastPort()
Get the multicast port number for broadcasting coordinator address
getMulticastInterval
public int getMulticastInterval()
Get the length of the period for broadcasting coordinator address
getMulticastTTL
public int getMulticastTTL()
Get the TTL settings for the multicast socket
isMulticast
public boolean isMulticast()
Use multicast for resolving coordinator conflict
getResolutionInterval
public long getResolutionInterval()
Gets the coordinator conflict resolution timeout in milliseconds
isPriorityOrderEnabled
public boolean isPriorityOrderEnabled()
Use configurable priority for resolving coordinator conflict
Returns:
true if configurable priority is utilized
getLowerPortBoundry
public int getLowerPortBoundry()
Get the lowest allowed port number in which the server socket would bind
to.
Returns:
lower value of the port range. 0 if let the Operating System
decide
getUpperPortBoundry
public int getUpperPortBoundry()
Get the highest allowed port number in which the server socket would bind
to.
Returns:
upper value of the port range. 0 if let the Operating System
decide
setLowerPortBoundry
public void setLowerPortBoundry(int port)
Set the lowest allowed port number in which the server socket would bind
to.
Returns:
lower value of the port range. 0 if let the Operating System
decide
setUpperPortBoundry
public void setUpperPortBoundry(int port)
Set the highest allowed port number in which the server socket would bind
to.
Returns:
upper value of the port range. 0 if let the Operating System
decide