[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Ehcache durability during abrupt crash  XML
Forum Index -> Ehcache
Author Message
chinabab

neo

Joined: 05/07/2012 07:31:46
Messages: 2
Offline

Hi All,

Does ehcache supports following scenario.

I need to generate a sequence number every time I get a request. The new sequence number should be incremented by 1 every time. So, I can store a initial number in the ehcache. Every time I get a request, I read this value and increment by 1 and put back in cache.

If the system crashes abruptly during this process after I served few request, on restart of the cache service, can I get the last generated sequence number using ehcache? So that I can guarantee that I will not generate the old sequence numbers. I want to make sure that every time I generate I need to get a unique number.

Please confirm.

Thanks,
Chinna
steve

ophanim

Joined: 05/24/2006 14:22:53
Messages: 619
Offline

In clustered it does now. In standalone it will in the summer release. Just curious whether this needs to be monotonic or if you just need guaranteed no dups. You may want to batch for efficiency.

Cheers,
Steve

Want to post to this forum? Join the Terracotta Community
chinabab

neo

Joined: 05/07/2012 07:31:46
Messages: 2
Offline

Thanks Steve,

My requirement is to generate a sequence id for every transaction in multi-node environement. Currently we are using db based sequence generator which hits db everytime and causing performance issue. So, now I want to rely on inmemory with no data lost.

Thanks,
Chinna
klalithr

consul

Joined: 01/23/2011 10:58:07
Messages: 466
Offline

Thats where Terracotta toolkit helps. Simply use the Atomic long feature and increment it.

Karthik Lalithraj (Terracotta)
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team