JBoss.org Community Documentation
PojoCacheFactory provides a couple of static methods to instantiate and obtain a PojoCache instance.
/** * Create a PojoCache instance. Note that this will start the cache life cycle automatically. * @param config A configuration string that represents the file name that is used to * configure the underlying Cache instance. * @return PojoCache */ public static PojoCache createInstance(String config); /** * Create a PojoCache instance. * @param config A configuration string that represents the file name that is used to * configure the underlying Cache instance. * @param start If true, it will start the cache life cycle. * @return PojoCache */ public static PojoCache createInstance(String config, boolean start); /** * Create a PojoCache instance. * @param config A configuration object that is used to configure the underlying Cache instance. * @param start If true, it will start the cache life cycle. * @return PojoCache */ public static PojoCache createInstance(Configuration config, boolean start);
For example, to obtain a PojoCache instance and start the cache lifestyle automatically, we can do:
String configFile = "META-INF/replSync-service.xml"; PojoCache cache = PojoCacheFactory.createInstance(configFile);