Class CacheImpl<K,​V>

  • All Implemented Interfaces:
    Cache<K,​V>

    public class CacheImpl<K,​V>
    extends java.lang.Object
    implements Cache<K,​V>
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheImpl​(javax.cache.Cache<K,​V> cache)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V computeIfAbsent​(K cacheKey, io.vavr.CheckedFunction0<V> supplier)
      If the key is not already associated with a cached value, attempts to compute its value using the given supplier and puts it into the cache.
      Cache.EventPublisher getEventPublisher()
      Returns an EventPublisher which can be used to register event consumers.
      Cache.Metrics getMetrics()
      Returns the Metrics of this Cache.
      java.lang.String getName()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CacheImpl

        public CacheImpl​(javax.cache.Cache<K,​V> cache)
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Cache<K,​V>
        Returns:
        the cache name
      • getMetrics

        public Cache.Metrics getMetrics()
        Description copied from interface: Cache
        Returns the Metrics of this Cache.
        Specified by:
        getMetrics in interface Cache<K,​V>
        Returns:
        the Metrics of this Cache
      • computeIfAbsent

        public V computeIfAbsent​(K cacheKey,
                                 io.vavr.CheckedFunction0<V> supplier)
        Description copied from interface: Cache
        If the key is not already associated with a cached value, attempts to compute its value using the given supplier and puts it into the cache. Otherwise it returns the cached value. If the function itself throws an (unchecked) exception, the exception is rethrown.
        Specified by:
        computeIfAbsent in interface Cache<K,​V>
        Parameters:
        cacheKey - key with which the specified value is to be associated
        supplier - value to be associated with the specified key
        Returns:
        cached value
      • getEventPublisher

        public Cache.EventPublisher getEventPublisher()
        Description copied from interface: Cache
        Returns an EventPublisher which can be used to register event consumers.
        Specified by:
        getEventPublisher in interface Cache<K,​V>
        Returns:
        an EventPublisher