@ThreadSafe
public interface CacheFactory<K,V>
CacheFactory factory = DefaultCacheFactory.getInstance();
Cache cache = factory.createCache("replSync-service.xml"); // expects this file to be in classpath
cache.stop();
Factory methods provide options for creating a cache using
Configuration objectCache,
DefaultCacheFactory| Modifier and Type | Method and Description |
|---|---|
Cache<K,V> |
createCache()
Creates and starts a
Cache instance using default configuration settings. |
Cache<K,V> |
createCache(boolean start)
Creates and optionally starts a
Cache instance using default configuration settings. |
Cache<K,V> |
createCache(Configuration configuration)
Creates a
Cache instance based on a Configuration passed in. |
Cache<K,V> |
createCache(Configuration configuration,
boolean start)
Creates
Cache instance, and optionally starts it, based on a Configuration passed in. |
Cache<K,V> |
createCache(InputStream is)
Creates a
Cache instance based on an InputStream passed in, which should be a stream to a valid
XML configuration file. |
Cache<K,V> |
createCache(InputStream is,
boolean start)
Creates a
Cache instance based on an InputStream passed in, which should be a stream to a valid
XML configuration file. |
Cache<K,V> |
createCache(String configFileName)
Creates and starts a
Cache instance. |
Cache<K,V> |
createCache(String configFileName,
boolean start)
Creates
Cache instance, and optionally starts it. |
Cache<K,V> createCache() throws ConfigurationException
Cache instance using default configuration settings. See Configuration for default values.ConfigurationException - if there are problems with the default configurationCache<K,V> createCache(boolean start) throws ConfigurationException
Cache instance using default configuration settings. See Configuration for default values.start - if true, starts the cacheConfigurationException - if there are problems with the default configurationCache<K,V> createCache(String configFileName) throws ConfigurationException
Cache instance. The following are all valid calls:
factory.createCache("myCacheService.xml"); // file is in class path
factory.createCache("etc/myCacheService.xml"); // file is in etc/ relative to the directory you started the JVM
factory.createCache("/home/jbosscache/myCacheService.xml"); // file is in the /home/jbosscache directory
configFileName - the named XML file should exist in the classpath or should be a fully qualified or relative (to your JVM working directory) path to a file on the local file system. Note that the classpath is checked first for the existence of this file.Cache instanceConfigurationException - if there are problems with the configurationCache<K,V> createCache(String configFileName, boolean start) throws ConfigurationException
Cache instance, and optionally starts it.configFileName - the named XML file should exist in the classpath or should be a fully qualified or relative (to your JVM working directory) path to a file on the local file system. Note that the classpath is checked first for the existence of this file.start - if true, the cache is started before returning.Cache instanceConfigurationException - if there are problems with the configurationfor examples on valid config file names.Cache<K,V> createCache(Configuration configuration) throws ConfigurationException
Cache instance based on a Configuration passed in.
Ensure that the Configuration you pass in is not used by another cache instance in the same JVM,
as it may be concurrently modified. Clone the configuration, if shared, using
Configuration.clone().configuration - the Configuration object that is passed in to setCache the Cache.Cache instanceConfigurationException - if there are problems with the configurationCache<K,V> createCache(Configuration configuration, boolean start) throws ConfigurationException
Cache instance, and optionally starts it, based on a Configuration passed in.
Ensure that the Configuration you pass in is not used by another cache instance in the same JVM,
as it may be concurrently modified. Clone the configuration, if shared, using
Configuration.clone().configuration - the Configuration object that is passed in to setCache the Cache.start - if true, the cache is started before returning.Cache instanceConfigurationException - if there are problems with the configurationCache<K,V> createCache(InputStream is) throws ConfigurationException
Cache instance based on an InputStream passed in, which should be a stream to a valid
XML configuration file.is - the InputStreamCache instanceConfigurationException - if there are problems with the configurationCache<K,V> createCache(InputStream is, boolean start) throws ConfigurationException
Cache instance based on an InputStream passed in, which should be a stream to a valid
XML configuration file.is - the InputStreamstart - if true, the cache is started before returning.Cache instanceConfigurationException - if there are problems with the configurationCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.