public interface CacheConflictContext<K,V>
Modifier and Type | Method and Description |
---|---|
void |
merge(V mergeVal,
long ttl)
Force cache to use neither old, nor new, but some other value passed as argument.
|
CacheConflictEntry<K,V> |
newEntry()
Gets new cache entry.
|
CacheConflictEntry<K,V> |
oldEntry()
Gets old (existing) cache entry.
|
void |
useNew()
Force cache to apply new entry overwriting old (existing) entry.
|
void |
useOld()
Force cache to ignore new entry and leave old (existing) entry unchanged.
|
CacheConflictEntry<K,V> oldEntry()
CacheConflictEntry<K,V> newEntry()
void useOld()
void useNew()
Note that updates from remote data centers always have explicit TTL.
In the latter case new entry will pick TTL of the old (existing) entry, even
if it was set through update from remote data center. it means that depending on concurrent
update timings new update might pick unexpected TTL. For example, consider that three updates
of the same key are performed: local update with explicit TTL (1) followed by another local
update without explicit TTL (2) and one remote update (3). In this case you might expect that
update (2) will pick TTL set during update (1). However, in case update (3) occurrs between (1)
and (2) and it overwrites (1) during conflict resolution, then update (2) will pick TTL of
update (3). To have predictable TTL in such cases you should either always set it explicitly
through GridCacheEntry.timeToLive(long)
or use merge(Object, long)
.
void merge(V mergeVal, long ttl)
Also in case of merge you have to specify new TTL explicitly. For unlimited TTL use 0
.
mergeVal
- Merge value or null
to force remove.ttl
- Time to live in milliseconds.
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024