• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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: 42055
926
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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic