• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

L1 and L2 Cache

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

How exactly does this work. L1 is by default available and L2 is configurable. When I say L1 cache, where exactly the caching happens? in the client or in the persistence context? Please help guys!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
L1 Cache is default because it is the persistence context. Meaning it has to be there in order for the session to know what has changed, what is new, and what to delete. So when you create a Session it has a bunch of Maps that store the objects it is managing. Actually the Session has a PersistenceContext object, in which that object has all those Maps.

So when you close the Session all that was in the Persistence Context/L1 Cache is now gone, bye bye, cease to exist. It is a dead parrot.

L2 Cache lives longer than a Session and is optional, you will need to include a cache provider like ehcache, JBoss Tree Cache, and others.

Mark
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic