Class CoherenceCache

  • All Implemented Interfaces:
    Cache

    public class CoherenceCache
    extends 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<Object,​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​(Object key)
        Specified by:
        evict in interface Cache
      • get

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

        public <T> T get​(Object key,
                         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.
      • 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