com.atlassian.cache.hazelcast
Class HazelcastHybridCachedReference<V>

java.lang.Object
  extended by com.atlassian.cache.hazelcast.ManagedHybridCacheSupport
      extended by com.atlassian.cache.hazelcast.HazelcastHybridCachedReference<V>
All Implemented Interfaces:
CachedReference<V>, ManagedCache

public class HazelcastHybridCachedReference<V>
extends ManagedHybridCacheSupport
implements CachedReference<V>

Implementation of ManagedCache and CachedReference that can be used when the cached value does not implement Serializable but reference invalidation must work cluster-wide.

Since:
2.4.0

Field Summary
 
Fields inherited from class com.atlassian.cache.hazelcast.ManagedHybridCacheSupport
flushable, name
 
Constructor Summary
HazelcastHybridCachedReference(String name, CacheFactory localFactory, com.hazelcast.core.IMap<ReferenceKey,Long> versionMap, Supplier<V> supplier, CacheSettings settings)
           
 
Method Summary
 void addListener(CachedReferenceListener<V> listener, boolean includeValues)
          Adds a CachedReferenceListener
 void clear()
          Clear the cache.
 V get()
          Get a value from the cache.
protected  ManagedCache getManagedCache()
           
 void removeListener(CachedReferenceListener<V> listener)
          Removes a CachedReferenceListener
 void reset()
          Resets (clears/invalidates) this reference.
 boolean updateMaxEntries(int newValue)
          Attempts to update the hint regarding the maximum number of entries that should be cached at any time.
 
Methods inherited from class com.atlassian.cache.hazelcast.ManagedHybridCacheSupport
currentExpireAfterAccessMillis, currentExpireAfterWriteMillis, currentMaxEntries, getName, getStatistics, isFlushable, isLocal, isReplicateAsynchronously, isReplicateViaCopy, updateExpireAfterAccess, updateExpireAfterWrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HazelcastHybridCachedReference

public HazelcastHybridCachedReference(String name,
                                      CacheFactory localFactory,
                                      com.hazelcast.core.IMap<ReferenceKey,Long> versionMap,
                                      Supplier<V> supplier,
                                      CacheSettings settings)
Method Detail

get

@Nonnull
public V get()
Description copied from interface: CachedReference
Get a value from the cache.

Specified by:
get in interface CachedReference<V>
Returns:
the cached value

reset

public void reset()
Description copied from interface: CachedReference
Resets (clears/invalidates) this reference.

Specified by:
reset in interface CachedReference<V>

getManagedCache

protected ManagedCache getManagedCache()
Specified by:
getManagedCache in class ManagedHybridCacheSupport

clear

public void clear()
Description copied from interface: ManagedCache
Clear the cache.

Specified by:
clear in interface ManagedCache

updateMaxEntries

public boolean updateMaxEntries(int newValue)
Description copied from interface: ManagedCache
Attempts to update the hint regarding the maximum number of entries that should be cached at any time.

Specified by:
updateMaxEntries in interface ManagedCache
Overrides:
updateMaxEntries in class ManagedHybridCacheSupport
Parameters:
newValue - the new hint value
Returns:
true iff the hint has been updated to the new value. If a cache does not support changes at run-time, it must return false

addListener

public void addListener(@Nonnull
                        CachedReferenceListener<V> listener,
                        boolean includeValues)
Description copied from interface: CachedReference
Adds a CachedReferenceListener

Specified by:
addListener in interface CachedReference<V>
Parameters:
listener - the listener
includeValues - if the events sent to this listener will include old/new value. This can be used in cases when the cost of finding these values is big (network sync) but the listener is not interested in the concrete values for events its getting. The support for this parameter is optional and implementation dependent

removeListener

public void removeListener(@Nonnull
                           CachedReferenceListener<V> listener)
Description copied from interface: CachedReference
Removes a CachedReferenceListener

Specified by:
removeListener in interface CachedReference<V>
Parameters:
listener - the listener


Copyright © 2015 Atlassian. All rights reserved.