[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
How to ensure data consistencies acroess 2 differenct caches  XML
Forum Index -> Ehcache
Author Message
halbert

journeyman

Joined: 12/22/2010 14:18:29
Messages: 29
Offline

I'm using terracotta in a clustered environment.

I have 2 distributed caches, call them cache1 and cache2

Say the the initial state of the caches are as follows:

cache1: { key="hello", value=1 }
cache2: { key="hello", value="A" }

What the best way to ensure that changes to the 2 caches are atomic.

So if something changes the state of the caches to this:

cache1.put("hello", 2)
cache2.put("hello", "B" }

i don't want this to happen when getting the values from the cache:
cache1.get("hello") == 2
cache2.get("hello") == "A"

I'm ok with getting the initial state after the cache has been changed (i don't need strong consistency) but having one new value and the other old is unacceptable to me.



klalithr

consul

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

Did you go through these links?

http://ehcache.org/documentation/2.4/terracotta/consistency-options

http://ehcache.org/documentation/apis/explicitlocking

They should answer your questions? No?

Karthik Lalithraj (Terracotta)
halbert

journeyman

Joined: 12/22/2010 14:18:29
Messages: 29
Offline

I think local transactionalMode is what I need but do I need to have consistency=strong as well?

halbert

journeyman

Joined: 12/22/2010 14:18:29
Messages: 29
Offline

Ok, looks like consistency must be "strong" when using local transactions.

 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team