The new programmatic model for constructing an instance of the cache in Habanero utilises a CacheFactory. Typically, here is how it would be done:
| CacheFactory factory = new DefaultCacheFactory(); // users may create a singleton wrapper for this
|
| Cache c = factory.createCache("myCacheService.xml"); // c is now running and ready for use.
|
Currently the CacheFactory interface is overloaded as such:
| public interface CacheFactory
| {
| /**
| * Creates and starts a {@link org.jboss.cache.Cache} instance
| * @param configFileName the named XML file should exist in the classpath.
| * @return a running {@link org.jboss.cache.Cache} instance
| */
| Cache createCache(String configFileName) throws ConfigurationException;
|
| /**
| * Creates {@link Cache} instance, and optionally starts it.
| * @param configFileName the named XML file should exist in the classpath.
| * @param start if true, the cache is started before returning.
| * @return an optionally running {@link Cache} instance
| */
| Cache createCache(String configFileName, boolean start) throws ConfigurationException;
|
| /**
| * Creates a {@link Cache} instance
| * @param configuration the {@link Configuration} object that is passed in to configure the {@link Cache}.
| * @return a running {@link Cache} instance
| */
| Cache createCache(Configuration configuration) throws ConfigurationException;
|
| /**
| * Creates {@link Cache} instance, and optionally starts it.
| * @param configuration the {@link Configuration} object that is passed in to configure the {@link Cache}.
| * @param start if true, the cache is started before returning.
| * @return an optionally running {@link Cache} instance
| */
| Cache createCache(Configuration configuration, boolean start) throws ConfigurationException;
| }
|
Is there a need to provide a mechanism to create a cache using an existing (and possibly running) JGroups channel? I.e., something analogous to new TreeCache(myChannel);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960147#3960147
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960147