Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Ruben Jackson   on Jan 17 In Java Category.

  
Question Answered By: Qadriyyah Malik   on Jan 17

EntityManager is the one that provides caching mechanism through attached entity instances. As long as you have a persistence context - which is a set of managed entity instances - the instances will be accessible through entitymanager interface. in another word, as long as entity instances are attaced, they are accessible. you can access them by using their primary key as the id of the cach (which is in map nature)

JBoss uses JBoss cache  beneath to manage caching, here is something you might want to look at:

docs.jboss.org/.../clusteredentity.html

a hint though:

to end up with a better performance, it is good practice to

i) avoid caching for entities that you frequienty "update" - because if you keep updating entities and IF your system is clustered based, it takes time to update all remote caches in clusters and introduces network traffic overload. please note that this might not be an issue for non-clustered systems (single server).
ii) avoid caching for entities that you are NOT frequently accessed because entities that are not access regularly and are pretty huge in size might allocate too much memory that actually should have been used for entities that ARE access more frequently
iii) try to use cache for only entities that you frequently "access" and consider good amount of memory for them - well because this is what caching is about,

Share: