Package com.alachisoft.ncache.client
Class CacheManager
- java.lang.Object
-
- com.alachisoft.ncache.client.CacheManager
-
public final class CacheManager extends java.lang.Object
Provides and manages the instance ofCache
-
-
Constructor Summary
Constructors Constructor Description CacheManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Cache
getCache(java.lang.String cacheName)
Returns an instance ofCache
for this application.static Cache
getCache(java.lang.String cacheName, CacheConnectionOptions cacheConnectionOptions)
Returns an instance ofCache
for this application.static Cache
getCache(java.lang.String cacheName, CacheConnectionOptions cacheConnectionOptions, java.lang.String clientCacheName, CacheConnectionOptions clientCacheConnectionOptions)
Returns an instance ofCache
for this application.static CacheCollection
getCaches()
ReturnsCacheCollection
of the caches initialized within the same application domain.static void
setConfigPath(java.lang.String path)
hiddenstatic void
startCache(java.lang.String cacheName, CacheConnection connection)
Starts an out-proc cache.static void
stopCache(java.lang.String cacheName, CacheConnection connection, boolean gracefullyShutDownNode)
Stops an out-proc cache.
-
-
-
Method Detail
-
getCaches
public static CacheCollection getCaches()
ReturnsCacheCollection
of the caches initialized within the same application domain.- Returns:
- The collection of caches within the same application domain.
-
setConfigPath
public static void setConfigPath(java.lang.String path)
hidden- Parameters:
path
-
-
getCache
public static Cache getCache(java.lang.String cacheName) throws java.lang.Exception
Returns an instance ofCache
for this application.
-
getCache
public static Cache getCache(java.lang.String cacheName, CacheConnectionOptions cacheConnectionOptions) throws java.lang.Exception
Returns an instance ofCache
for this application.- Parameters:
cacheName
- The identifier for theCache
.cacheConnectionOptions
-CacheConnectionOptions
parameters for cache connection.- Returns:
- Instance of
Cache
. - Throws:
java.lang.Exception
-
getCache
public static Cache getCache(java.lang.String cacheName, CacheConnectionOptions cacheConnectionOptions, java.lang.String clientCacheName, CacheConnectionOptions clientCacheConnectionOptions) throws java.lang.Exception
Returns an instance ofCache
for this application.- Parameters:
cacheName
- The identifier for theCache
.cacheConnectionOptions
-CacheConnectionOptions
parameters for cache connection.clientCacheName
- The identifier for the ClientCache.clientCacheConnectionOptions
-CacheConnectionOptions
parameters for ClientCache connection.- Returns:
- Instance of
Cache
. - Throws:
java.lang.Exception
-
startCache
public static void startCache(java.lang.String cacheName, CacheConnection connection) throws Alachisoft.NCache.Common.Exceptions.ManagementException, java.net.UnknownHostException, ConfigurationException
Starts an out-proc cache. The end result is the same as that of starting the cache using NCache Manager. It starts the cache on the specified cache server. If the Cache Server could not be contacted then it throws aManagementException
exception. It tries to get the Security Parameters from the client.ncconf.- Parameters:
cacheName
- The identifier for theCache
.connection
-CacheConnection
parameters for connection to Cache.- Throws:
Alachisoft.NCache.Common.Exceptions.ManagementException
java.net.UnknownHostException
ConfigurationException
-
stopCache
public static void stopCache(java.lang.String cacheName, CacheConnection connection, boolean gracefullyShutDownNode) throws Alachisoft.NCache.Common.Exceptions.ManagementException, java.net.UnknownHostException, ConfigurationException
Stops an out-proc cache. The end result is the same as that of stoping the cache using NCache Manager. It stops the cache only on the same server where the client application is running. If the Cache Server could not be contacted then it throws aManagementException
exception. It tries to get the Security Parameters from the client.ncconf.- Parameters:
cacheName
- The identifier for theCache
.connection
-CacheConnection
parameters for connection to Cache.gracefullyShutDownNode
- The flag for graceful node shutdown.- Throws:
Alachisoft.NCache.Common.Exceptions.ManagementException
java.net.UnknownHostException
ConfigurationException
-
-