Class TrellisCache<K,​V>

  • Type Parameters:
    K - the key type
    V - the value type
    All Implemented Interfaces:
    CacheService<K,​V>

    public class TrellisCache<K,​V>
    extends Object
    implements CacheService<K,​V>
    A simple Guava-based cache service.
    • Constructor Detail

      • TrellisCache

        public TrellisCache​(com.google.common.cache.Cache<K,​V> cache)
        Create a Trellis cache.
        Parameters:
        cache - the guava cache
    • Method Detail

      • get

        public V get​(K key,
                     Function<K,​V> mapper)
        Description copied from interface: CacheService
        Get a value from the cache.
        Specified by:
        get in interface CacheService<K,​V>
        Parameters:
        key - the key
        mapper - attempts to compute a mapping for the specified key
        Returns:
        a value for that key, never null