Memoiser

object Memoiser

Support for building caches using Guava caches.

class Object
trait Matchable
class Any

Value members

Concrete methods

def buildCache[K <: AnyRef, V <: AnyRef](supplier: K => V): LoadingCache[K, V]

Builds a cache, which either returns an already-loaded value for a given key or atomically computes or retrieves it using the supplied { @code supplier }. If another thread is currently loading the value for this key, simply waits for that thread to finish and returns its loaded value. Note that multiple threads can concurrently load values for distinct keys.

Builds a cache, which either returns an already-loaded value for a given key or atomically computes or retrieves it using the supplied { @code supplier }. If another thread is currently loading the value for this key, simply waits for that thread to finish and returns its loaded value. Note that multiple threads can concurrently load values for distinct keys.

Value Params
supplier

the function to be used for loading values; must never return { @code null}

Returns

a cache loader that loads values by passing each key to { @code supplier}