| Author |
Message |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 05/07/2012 07:40:36
|
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
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 05/07/2012 23:05:56
|
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 |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 05/07/2012 23:26:54
|
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
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 05/08/2012 06:37:29
|
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) |
|
|
 |
|
|