• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ORM Cache Clearing General Question

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no real hibernate or ibatis (or any real ORM experience), but I am starting to learn ibatis. I have a general question on ORM caching. My assumption is that the objects are cached in java memory. So...in a typical environment (multiple app servers, one database) how do you clear cache across all app servers programatically?

Example:
2 app servers, serverA and serverB
one object is cached on serverA...we'll call it InventoryList (list of available inventory)
serverA gets a call to updateInventory service which clears cache of InventoryList object on serverA

doesn't serverB still have the cached old object still there (not purged)?

Thanks,
Jim
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You ideally would want to cluster the two app servers. Other option would be to retrieve the object from the db every time you do some operation so you are ensured the data is fresh.
 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>>You ideally would want to cluster the two app servers.
I do not understand how that helps. Presumably the cached objects are stored in JVM memory which would not be shared in a cluster (correct me if I'm wrong...but I don't see how it could).

>>Other option would be to retrieve the object from the db every time you do some operation so you are ensured the data is fresh.
Doesn't that defeat the point of caching?

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James,
The idea is there is memory to memory replication between the clusters. This has efficiency issues of it's own and my or may not be worth the cost.

There are different levels of ORM caching. You can cache within a user transaction without any problem since transactions guarantee that data hasn't changed out from under you. For higher level caching, you can look at data patterns. Is anything known about your data? Maybe some data that is essentially read only and you can cache for a certain amount of time. For example, the list of 50 states.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic