JBoss.org Community Documentation

- Prev
- Next

## 4.1. PojoCacheFactory Class

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);

- PrevChapter 4. API Overview
- Top of page
- Front page
- Next4.2. PojoCache Interface