com.hazelcast.hibernate.local
Class LocalRegionCache
java.lang.Object
com.hazelcast.hibernate.local.LocalRegionCache
- All Implemented Interfaces:
- RegionCache
- Direct Known Subclasses:
- TimestampsRegionCache
public class LocalRegionCache
- extends Object
- implements RegionCache
Local only RegionCache
implementation
based on a topic to distribute cache updates.
Method Summary |
Map |
asMap()
|
void |
clear()
|
boolean |
contains(Object key)
|
protected Object |
createMessage(Object key,
Object value,
Object currentVersion)
|
protected MessageListener<Object> |
createMessageListener()
|
Object |
get(Object key)
|
long |
getSizeInMemory()
|
boolean |
put(Object key,
Object value,
Object currentVersion)
|
boolean |
remove(Object key)
|
long |
size()
|
SoftLock |
tryLock(Object key,
Object version)
|
void |
unlock(Object key,
SoftLock lock)
|
boolean |
update(Object key,
Object value,
Object currentVersion,
Object previousVersion,
SoftLock lock)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
topic
protected final ITopic<Object> topic
messageListener
protected final MessageListener<Object> messageListener
cache
protected final ConcurrentMap<Object,Value> cache
versionComparator
protected final Comparator versionComparator
config
protected MapConfig config
LocalRegionCache
public LocalRegionCache(String name,
HazelcastInstance hazelcastInstance,
CacheDataDescription metadata)
- Parameters:
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)
LocalRegionCache
public LocalRegionCache(String name,
HazelcastInstance hazelcastInstance,
CacheDataDescription metadata,
boolean withTopic)
- Parameters:
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 provided- Since:
- 3.3
get
public Object get(Object key)
- Specified by:
get
in interface RegionCache
put
public boolean put(Object key,
Object value,
Object currentVersion)
- Specified by:
put
in interface RegionCache
update
public boolean update(Object key,
Object value,
Object currentVersion,
Object previousVersion,
SoftLock lock)
- Specified by:
update
in interface RegionCache
createMessage
protected Object createMessage(Object key,
Object value,
Object currentVersion)
createMessageListener
protected MessageListener<Object> createMessageListener()
remove
public boolean remove(Object key)
- Specified by:
remove
in interface RegionCache
tryLock
public SoftLock tryLock(Object key,
Object version)
- Specified by:
tryLock
in interface RegionCache
unlock
public void unlock(Object key,
SoftLock lock)
- Specified by:
unlock
in interface RegionCache
contains
public boolean contains(Object key)
- Specified by:
contains
in interface RegionCache
clear
public void clear()
- Specified by:
clear
in interface RegionCache
size
public long size()
- Specified by:
size
in interface RegionCache
getSizeInMemory
public long getSizeInMemory()
- Specified by:
getSizeInMemory
in interface RegionCache
asMap
public Map asMap()
- Specified by:
asMap
in interface RegionCache
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.