I have cache query and a certain class has been loaded in cache completely type like a follow:
List clients = sess.createCriteria(Client.class)
.setCacheable(true)
.list();
while I do not change the Client, it is work properly - all objects loaded from L2 cache. Database no action.
If there are copy of created object Client in other session / thread created and kept
tr = sess.beginTransaction();
Client cl = new Client();
sess.save(cl);
tr.commit();
sess.close();
That this action will cause invalidete region cache :
2006-04-27 09:47:48,109 (UpdateTimestampsCache.java:51) - Pre-invalidating space [Client]
insert occur ..
2006-04-27 09:47:48,281 (UpdateTimestampsCache.java:64) - Invalidating space [Client], timestamp: 1146116868281
How to make so that query
List clients = sess.createCriteria(Client.class)
.setCacheable(true)
.list();
did not access in a DB (so invalidete query region), in fact all necessary data already are in L2 cache !
|