Class CoherenceCache

  • All Implemented Interfaces:
    Cache

    public class CoherenceCache
    extends java.lang.Object
    implements Cache
    Coherence-specific implementation of Cache that defines common cache operations.
    Since:
    3.0
    Author:
    Gunnar Hillert
    • Constructor Detail

      • CoherenceCache

        public CoherenceCache​(com.tangosol.net.NamedCache<java.lang.Object,​java.lang.Object> cache,
                              CoherenceCacheConfiguration cacheConfiguration)
        Construct the CoherenceCache.
        Parameters:
        cache - must not be null
        cacheConfiguration - must not be null
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface Cache
      • evict

        public void evict​(java.lang.Object key)
        Specified by:
        evict in interface Cache
      • get

        public <T> T get​(java.lang.Object key,
                         java.lang.Class<T> type)
        Specified by:
        get in interface Cache
      • get

        public <T> T get​(java.lang.Object key,
                         java.util.concurrent.Callable<T> valueLoader)
        Return the value to which this cache maps the specified key. If the key does not exist in the cache, the method will obtain that value using the provided valueLoader. In that case, the key will be locked, unless CoherenceCacheConfiguration.isUseLocks() returns false.
        Specified by:
        get in interface Cache
        Type Parameters:
        T - type of the return value.
        Parameters:
        key - might be null. See Map.get(Object).
        valueLoader - must not be null.
        Returns:
        the value from the cache.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Cache
      • getNativeCache

        public java.lang.Object getNativeCache()
        Specified by:
        getNativeCache in interface Cache
      • put

        public void put​(java.lang.Object key,
                        java.lang.Object value)
        Specified by:
        put in interface Cache
      • size

        public int size()
        Returns the number of key-value mappings of the underlying NamedCache.
        Returns:
        the number of key-value mappings in this map