object
FutureCache
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
default[K, V](fn: (K) ⇒ Future[V], cache: FutureCache[K, V]): (K) ⇒ Future[V]
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
def
fromMap[K, V](fn: (K) ⇒ Future[V], map: ConcurrentMap[K, Future[V]]): (K) ⇒ Future[V]
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
def
keyEncoded[K, V, U](encode: (K) ⇒ V, cache: FutureCache[V, U]): FutureCache[K, U]
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
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 Guava Caches. There's an API that makes it easy to use Guava caches, and can be found in the util-collection lib. The object is called com.twitter.cache.guava.Guava$.