object FutureCache
The FutureCache object provides the public interface for constructing FutureCaches. Once you've constructed a basic FutureCache, you should almost always wrap it with default. Normal usage looks like:
val fn: K => Future[V] val map = (new java.util.concurrent.ConcurrentHashMap[K, V]()).asScala val cachedFn: K => Future[V] = FutureCache.default(fn, FutureCache.fromMap(map))
We typically recommend that you use Caffeine
Caches via
com.twitter.cache.caffeine.CaffeineCache.
- Alphabetic
- By Inheritance
- FutureCache
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def default[K, V](fn: (K) => Future[V], cache: FutureCache[K, V]): (K) => Future[V]
Creates a function which caches the results of
fn
in an com.twitter.cache.FutureCache.Creates a function which caches the results of
fn
in an com.twitter.cache.FutureCache. Ensures that failed Futures are evicted, and that interrupting a Future returned to you by this function is safe.- See also
standard for the equivalent Java API.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fromMap[K, V](fn: (K) => Future[V], map: ConcurrentMap[K, Future[V]]): (K) => Future[V]
A
com.twitter.cache.FutureCache
backed by ajava.util.concurrent.ConcurrentMap
. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def keyEncoded[K, V, U](encode: (K) => V, cache: FutureCache[V, U]): FutureCache[K, U]
Encodes keys, producing a Cache that takes keys of a different type.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def standard[K, V](fn: (K) => Future[V], cache: FutureCache[K, V]): (K) => Future[V]
Alias for default which can be called from Java.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()