org.feijoas.mango.common.cache

LoadingCacheWrapper

Related Doc: package cache

trait LoadingCacheWrapper[K, V] extends CacheWrapper[K, V] with LoadingCache[K, V]

An adapter that wraps a Guava-LoadingCache in a LoadingCache and forwards all method calls to the underlying Guava-LoadingCache.

Attributes
protected[org.feijoas.mango]
Since

0.7

Linear Supertypes
LoadingCache[K, V], (K) ⇒ V, CacheWrapper[K, V], Cache[K, V], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LoadingCacheWrapper
  2. LoadingCache
  3. Function1
  4. CacheWrapper
  5. Cache
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def cache: com.google.common.cache.LoadingCache[K, V]

    Returns the backing Guava LoadingCache delegate instance that methods are forwarded to.

    Returns the backing Guava LoadingCache delegate instance that methods are forwarded to. Concrete subclasses override this method to supply the instance being decorated.

    Attributes
    protected
    Definition Classes
    LoadingCacheWrapperCacheWrapper

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. def andThen[A](g: (V) ⇒ A): (K) ⇒ A

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  5. final def apply(keys: Traversable[K]): Map[K, V]

    Returns a map of the values associated with keys, creating or retrieving those values if necessary.

    Returns a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries; it will never contain null keys or values. The method simply forwards to getAll(keys).

    Definition Classes
    LoadingCache
  6. final def apply(key: K): V

    Returns the value associated with key in this cache, first loading that value if necessary.

    Returns the value associated with key in this cache, first loading that value if necessary. No observable state associated with this cache is modified until loading completes. The method simply forwards to get(key).

    Definition Classes
    LoadingCache → Function1
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def asMap(): Map[K, V]

    Returns a view of the entries stored in this cache as a thread-safe map.

    Returns a view of the entries stored in this cache as a thread-safe map. Modifications made to the map directly affect the cache.

    Definition Classes
    CacheWrapperCache
  9. def cleanUp(): Unit

    Performs any pending maintenance operations needed by the cache.

    Performs any pending maintenance operations needed by the cache. Exactly which activities are performed -- if any -- is implementation-dependent.

    Definition Classes
    CacheWrapperCache
  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def compose[A](g: (A) ⇒ K): (A) ⇒ V

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  12. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def get(key: K): Try[V]

    Returns the value associated with key in this cache, first loading that value if necessary.

    Returns the value associated with key in this cache, first loading that value if necessary. No observable state associated with this cache is modified until loading completes.

    If another call to #get or #getIfPresent is currently loading the value for key, simply waits for that thread to finish and returns its loaded value. Note that multiple threads can concurrently load values for distinct keys.

    Caches loaded by a CacheLoader will call CacheLoader#load to load new values into the cache. If another value was associated with key while the new value was loading then a removal notification will be sent for the new value.

    The CacheLoader should not throw exceptions. If the calculation from a CacheLoader can fail the use of CacheLoader[K,Option[V]] or CacheLoader[K,Try[V]] is preferred. If the cache loader associated with this cache is known not to throw checked exceptions, then prefer #getUnchecked over this method.

    Definition Classes
    LoadingCacheWrapperLoadingCache
    Exceptions thrown

    ExecutionError if an error was thrown while loading the value

    ExecutionException if a checked exception was thrown while loading the value

    UncheckedExecutionException if an unchecked exception was thrown while loading the value

  16. def getAll(keys: Traversable[K]): Try[Map[K, V]]

    Returns a map of the values associated with keys, creating or retrieving those values if necessary.

    Returns a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries; it will never contain null keys or values.

    Caches loaded by a CacheLoader will issue a single request to CacheLoader#loadAll for all keys which are not already present in the cache. All entries returned by CacheLoader#loadAll will be stored in the cache, over-writing any previously cached values. This method will throw an exception if CacheLoader#loadAll returns null, returns a map containing null keys or values, or fails to return an entry for each requested key.

    Note that duplicate elements in keys, as determined by ==, will be ignored.

    Definition Classes
    LoadingCacheWrapperLoadingCache
    Exceptions thrown

    ExecutionError if an error was thrown while loading the values

    ExecutionException if a checked exception was thrown while loading the values

    UncheckedExecutionException if an unchecked exception was thrown while loading the values

  17. def getAllPresent(keys: Traversable[K]): Map[K, V]

    Returns a map of the values associated with keys in this cache.

    Returns a map of the values associated with keys in this cache. The returned map will only contain entries which are already present in the cache.

    Definition Classes
    CacheWrapperCache
  18. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  19. def getIfPresent(key: K): Option[V]

    Returns an Option which is Some(value) with the value associated with key in this cache, or None if there is no cached value for key.

    Returns an Option which is Some(value) with the value associated with key in this cache, or None if there is no cached value for key.

    Definition Classes
    LoadingCacheWrapperCacheWrapperCache
  20. def getOrElseUpdate(key: K, loader: () ⇒ V): V

    Returns the value associated with key in this cache, obtaining that value from loader if necessary.

    Returns the value associated with key in this cache, obtaining that value from loader if necessary. No observable state associated with this cache is modified until loading completes. This method provides a simple substitute for the conventional if cached, return; otherwise create, cache and return pattern.

    Warning: as with CacheLoader#load, loader must not return null; it may either return a non-null value or throw an exception. The recommend way would be to use a Cache[K, Option[V]] with loader return None instead of throwing an exception.

    This method is equivalent to Cache.get(K, Callable<? extends V>) from the Guava-Libraries.

    Definition Classes
    CacheWrapperCache
    Exceptions thrown

    ExecutionError if an error was thrown while loading the value

    ExecutionException if a checked exception was thrown while loading the value

    UncheckedExecutionException if an unchecked exception was thrown while loading the value

  21. def getUnchecked(key: K): V

    Returns the value associated with key in this cache, first loading that value if necessary.

    Returns the value associated with key in this cache, first loading that value if necessary. No observable state associated with this cache is modified until loading completes. Unlike #get, this method does not handle checked exceptions, and thus should only be used in situations where checked exceptions are not thrown by the cache loader.

    If another call to #get or #getUnchecked is currently loading the value for key, simply waits for that thread to finish and returns its loaded value. Note that multiple threads can concurrently load values for distinct keys.

    Caches loaded by a CacheLoader will call CacheLoader#load to load new values into the cache. Newly loaded values are added to the cache using Cache.asMap().putIfAbsent after loading has completed; if another value was associated with key while the new value was loading then a removal notification will be sent for the new value.

    Warning: this method silently converts checked exceptions to unchecked exceptions, and should not be used with cache loaders which throw checked exceptions. In such cases use #get instead.

    Definition Classes
    LoadingCacheWrapperLoadingCache
    Exceptions thrown

    ExecutionError if an error was thrown while loading the value

    UncheckedExecutionException if an exception was thrown while loading the value, regardless of whether the exception was checked or unchecked

  22. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  23. def invalidate(key: K): Unit

    Discards any cached value for key key.

    Discards any cached value for key key.

    Definition Classes
    CacheWrapperCache
  24. def invalidateAll(): Unit

    Discards all entries in the cache.

    Discards all entries in the cache.

    Definition Classes
    CacheWrapperCache
  25. def invalidateAll(keys: Traversable[K]): Unit

    Discards any cached values for keys keys.

    Discards any cached values for keys keys.

    Definition Classes
    CacheWrapperCache
  26. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  30. def put(key: K, value: V): Unit

    Adds a new key/value pair to this cache.

    Adds a new key/value pair to this cache. If the cache previously contained a value associated with the key, the old value is replaced by the value.

    Prefer getOrElseUpdate(key, loader) when using the conventional if cached, return; otherwise create, cache and return pattern.

    Definition Classes
    CacheWrapperCache
  31. def putAll(kvs: Traversable[(K, V)]): Unit

    Puts all key/value pairs from the specified Traversable to the cache.

    Puts all key/value pairs from the specified Traversable to the cache. The effect of this call is equivalent to that of calling put(key, value) for each (key, value) in the Traversable. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

    Definition Classes
    CacheWrapperCache
  32. def refresh(key: K): Unit

    Loads a new value for key key, possibly asynchronously.

    Loads a new value for key key, possibly asynchronously. While the new value is loading the previous value (if any) will continue to be returned by get(key) unless it is evicted. If the new value is loaded successfully it will replace the previous value in the cache; if an exception is thrown while refreshing the previous value will remain, and the exception will be logged (using `java.util.logging.Logger`) and swallowed.

    Caches loaded by a CacheLoader will call CacheLoader#reload if the cache currently contains a value for key, and CacheLoader#load otherwise. Loading is asynchronous only if CacheLoader#reload was overridden with an asynchronous implementation.

    Returns without doing anything if another thread is currently loading the value for key. If the cache loader associated with this cache performs refresh asynchronously then this method may return before refresh completes.

    Definition Classes
    LoadingCacheWrapperLoadingCache
  33. def size(): Long

    Returns the approximate number of entries in this cache.

    Returns the approximate number of entries in this cache.

    Definition Classes
    CacheWrapperCache
  34. def stats(): CacheStats

    Returns a current snapshot of this cache's cumulative statistics.

    Returns a current snapshot of this cache's cumulative statistics. All stats are initialized to zero, and are monotonically increasing over the lifetime of the cache.

    Definition Classes
    CacheWrapperCache
  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  36. def toString(): String

    Definition Classes
    Function1 → AnyRef → Any
  37. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from LoadingCache[K, V]

Inherited from (K) ⇒ V

Inherited from CacheWrapper[K, V]

Inherited from Cache[K, V]

Inherited from AnyRef

Inherited from Any

Ungrouped