[jboss-user] [JBoss Cache] - How to do jboss caching

Amol Umrani do-not-reply at jboss.com
Wed Aug 25 02:20:31 EDT 2010

Amol Umrani [http://community.jboss.org/people/amolumrani] replied to the discussion

"How to do jboss caching"

To view the discussion, visit: http://community.jboss.org/message/558885#558885

Hello Navin,

Thanks for help.

I am doing as follows..

public class SimpleCaching
        GlobalConfiguration myGlobalConfig = new GlobalConfiguration();
        // configure myGlobalConfig accordingly
        EmbeddedCacheManager manager = new DefaultCacheManager(myGlobalConfig);

        Configuration config = new Configuration();
        // configure your config bean accordingly
        manager.defineConfiguration("myCustomCache", config);
        Cache customCache = manager.getCache("myCustomCache");

        customCache.put("key", "value");



        // remember that Cache extends ConcurrentMap!

        customCache.put("key", "value");
        customCache.putIfAbsent("key", "newValue");
    }catch(CacheException ex){

This is as per 5 minutes tutorial of infinispan.

My question is it right way to write the code for caching...

We are using JPA and i come to know we required to configure infinispan for second level cache in persistence.xml..

so in this code where i should pass this xml?

Please help me regarding this..



Reply to this message by going to Community

Start a new discussion in JBoss Cache at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100825/1f518e4c/attachment.html 

More information about the jboss-user mailing list