public class LocalRegionCache extends Object implements RegionCache
RegionCache implementation
based on a topic to distribute cache updates.| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<Object,Expirable> |
cache |
protected com.hazelcast.config.MapConfig |
config |
protected com.hazelcast.core.HazelcastInstance |
hazelcastInstance |
protected AtomicLong |
markerIdCounter |
protected com.hazelcast.core.MessageListener<Object> |
messageListener |
protected com.hazelcast.core.ITopic<Object> |
topic |
protected Comparator |
versionComparator |
| Constructor and Description |
|---|
LocalRegionCache(String name,
com.hazelcast.core.HazelcastInstance hazelcastInstance,
org.hibernate.cache.spi.CacheDataDescription metadata) |
LocalRegionCache(String name,
com.hazelcast.core.HazelcastInstance hazelcastInstance,
org.hibernate.cache.spi.CacheDataDescription metadata,
boolean withTopic) |
| Modifier and Type | Method and Description |
|---|---|
Map |
asMap() |
void |
clear() |
boolean |
contains(Object key) |
protected Object |
createMessage(Object key,
Object value,
Object currentVersion) |
protected com.hazelcast.core.MessageListener<Object> |
createMessageListener() |
Object |
get(Object key,
long txTimestamp) |
long |
getSizeInMemory() |
boolean |
insert(Object key,
Object value,
Object currentVersion) |
protected void |
maybeInvalidate(Object messageObject) |
protected void |
maybeNotifyTopic(Object key,
Object value,
Object version) |
protected long |
nextTimestamp() |
boolean |
put(Object key,
Object value,
long txTimestamp,
Object version) |
boolean |
remove(Object key) |
long |
size() |
org.hibernate.cache.spi.access.SoftLock |
tryLock(Object key,
Object version) |
void |
unlock(Object key,
org.hibernate.cache.spi.access.SoftLock lock) |
boolean |
update(Object key,
Object newValue,
Object newVersion,
org.hibernate.cache.spi.access.SoftLock softLock) |
protected final com.hazelcast.core.HazelcastInstance hazelcastInstance
protected final com.hazelcast.core.ITopic<Object> topic
protected final com.hazelcast.core.MessageListener<Object> messageListener
protected final ConcurrentMap<Object,Expirable> cache
protected final Comparator versionComparator
protected final AtomicLong markerIdCounter
protected com.hazelcast.config.MapConfig config
public LocalRegionCache(String name, com.hazelcast.core.HazelcastInstance hazelcastInstance, org.hibernate.cache.spi.CacheDataDescription metadata)
name - the name for this region cache, which is also used to retrieve configuration/topichazelcastInstance - the HazelcastInstance to which this region cache belongs, used to retrieve
configuration and to lookup an ITopic to register a MessageListener
with (optional)metadata - metadata describing the cached data, used to compare data versions (optional)public LocalRegionCache(String name, com.hazelcast.core.HazelcastInstance hazelcastInstance, org.hibernate.cache.spi.CacheDataDescription metadata, boolean withTopic)
name - the name for this region cache, which is also used to retrieve configuration/topichazelcastInstance - the HazelcastInstance to which this region cache belongs, used to retrieve
configuration and to lookup an ITopic to register a MessageListener
with if withTopic is true (optional)metadata - metadata describing the cached data, used to compare data versions (optional)withTopic - true to register a MessageListener with the ITopic whose name
matches this region cache if a HazelcastInstance was provided to look
up the topic; otherwise, false not to register a listener even if an instance
was providedpublic Object get(Object key, long txTimestamp)
get in interface RegionCachepublic boolean insert(Object key, Object value, Object currentVersion)
insert in interface RegionCachepublic boolean put(Object key, Object value, long txTimestamp, Object version)
put in interface RegionCachepublic boolean update(Object key, Object newValue, Object newVersion, org.hibernate.cache.spi.access.SoftLock softLock)
update in interface RegionCacheprotected com.hazelcast.core.MessageListener<Object> createMessageListener()
public boolean remove(Object key)
remove in interface RegionCachepublic org.hibernate.cache.spi.access.SoftLock tryLock(Object key, Object version)
tryLock in interface RegionCachepublic void unlock(Object key, org.hibernate.cache.spi.access.SoftLock lock)
unlock in interface RegionCachepublic boolean contains(Object key)
contains in interface RegionCachepublic void clear()
clear in interface RegionCachepublic long size()
size in interface RegionCachepublic long getSizeInMemory()
getSizeInMemory in interface RegionCachepublic Map asMap()
asMap in interface RegionCacheprotected void maybeInvalidate(Object messageObject)
protected long nextTimestamp()
Copyright © 2017. All Rights Reserved.