2.3. Usage

2.3. Usage

To use PojoCache, it is similar to its TreeCache counter part. Basically, you instantiate a PojoCache instance first. Then, you can either configure it programmatically or through an external xml file. Finally, you call the cache life cycle method to start the cache. Below is a code snippet that creates and starts the cache through an external xml file:

   cache_ = new PojoCache();
   PropertyConfigurator config = new PropertyConfigurator(); // configure tree cache.
   config.configure(cache_, "META-INF/replSync-service.xml"); // Search under the classpath
   cache_.start();
   ...
   cache_.stop();