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

Navin Surtani do-not-reply at jboss.com
Tue Aug 24 07:36:00 EDT 2010


Navin Surtani [http://community.jboss.org/people/navssurtani] replied to the discussion

"How to do jboss caching"

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

--------------------------------------------------------------
Hey Amol,
> 
> 
> 1) I am going through  http://community.jboss.org/wiki/5minutetutorialonInfinispan http://community.jboss.org/wiki/5minutetutorialonInfinispan.
> 
> I have download infinispan-4.1.0.CR3-all.zip from their site.
> 
> I want to see how object caching is done by infinispan.
> 
> bcoz of am new to caching can u tell me how to deploy this tutorial?
> 
> I have tried GUI Demo of Infinispan but not getting enough idea of object caching.
> 
> 
> 



What do you mean by Object caching? Do you mean actually how you put stuff into the cache and making use of it?

If so you can just do something like: - 


CacheManager cm = new DefaultCacheManager();
Cache<MySpecialKey, MySpecialValue> c = cm.getCache();
 
 
// Put some stuff into the cache
c.put(k1, v1);
 
//etc etc


Now I want to get the stuff out of the cache using a different app on a different JVM even. {Note that this will only work if the Caches are in DIST or REPL configuration and have the SAME configuration. Also note that the caches have the same String name in both cases}


CacheManager cm2 = new DefaultCacheManager();
Cache<MySpecialKey, MySpecialValue> c = cm2.getCache();
 
// Get my stuff out of the cache: - 
 
MySpecialValue specialValue = c.get(k1);
 
// etc etc



Obviously if that's not what you want and have a more complex problem then please let me know and I'll see if I can help.

With respect to the configuration file, as long as it's somewhere in your project directory it should be fine. Generally a good idea to keep it with your maven/ant build file or a config directory if you have one. Make sure you use the appropriate API on CacheManager though.

Hope that helps,
Navs.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/558733#558733]

Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100824/3db5a744/attachment.html 


More information about the jboss-user mailing list