com.twitter.storehaus.cache

Memoize

object Memoize extends AnyRef

Memoize supplies a number of functions for generating memoized versions of Scala's functions using a MutableCache instance.

For example,

import com.twitter.storehaus.cache._

scala> val sleepyToString = Memoize(MapCache.empty[Int, String].toMutable()) { i => println("CALCULATING!"); i.toString }
sleepyToString: com.twitter.storehaus.cache.Memoize22[Int,String] = <function22>

scala> sleepyToString(10)
CALCULATING!
res21: String = 10

scala> sleepyToString(10)
res22: String = 10

// Get the backing function back out with backingFn:

scala> sleepyToString.backingFn(10)
CALCULATING!
res2: String = 10
Source
Memoize
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Memoize
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

    Definition Classes
    Any
  6. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) ⇒ R): Memoize22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R]

  7. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) ⇒ R): Memoize21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R]

  8. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) ⇒ R): Memoize20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]

  9. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) ⇒ R): Memoize19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]

  10. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) ⇒ R): Memoize18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]

  11. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) ⇒ R): Memoize17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]

  12. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) ⇒ R): Memoize16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]

  13. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) ⇒ R): Memoize15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]

  14. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) ⇒ R): Memoize14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]

  15. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) ⇒ R): Memoize13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]

  16. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) ⇒ R): Memoize12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]

  17. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) ⇒ R): Memoize11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R]

  18. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) ⇒ R): Memoize10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]

  19. def apply[T1, T2, T3, T4, T5, T6, T7, T8, T9, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8, T9), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8, T9) ⇒ R): Memoize9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]

  20. def apply[T1, T2, T3, T4, T5, T6, T7, T8, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7, T8), R])(f: (T1, T2, T3, T4, T5, T6, T7, T8) ⇒ R): Memoize8[T1, T2, T3, T4, T5, T6, T7, T8, R]

  21. def apply[T1, T2, T3, T4, T5, T6, T7, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6, T7), R])(f: (T1, T2, T3, T4, T5, T6, T7) ⇒ R): Memoize7[T1, T2, T3, T4, T5, T6, T7, R]

  22. def apply[T1, T2, T3, T4, T5, T6, R](cache: MutableCache[(T1, T2, T3, T4, T5, T6), R])(f: (T1, T2, T3, T4, T5, T6) ⇒ R): Memoize6[T1, T2, T3, T4, T5, T6, R]

  23. def apply[T1, T2, T3, T4, T5, R](cache: MutableCache[(T1, T2, T3, T4, T5), R])(f: (T1, T2, T3, T4, T5) ⇒ R): Memoize5[T1, T2, T3, T4, T5, R]

  24. def apply[T1, T2, T3, T4, R](cache: MutableCache[(T1, T2, T3, T4), R])(f: (T1, T2, T3, T4) ⇒ R): Memoize4[T1, T2, T3, T4, R]

  25. def apply[T1, T2, T3, R](cache: MutableCache[(T1, T2, T3), R])(f: (T1, T2, T3) ⇒ R): Memoize3[T1, T2, T3, R]

  26. def apply[T1, T2, R](cache: MutableCache[(T1, T2), R])(f: (T1, T2) ⇒ R): Memoize2[T1, T2, R]

  27. def apply[T1, R](cache: MutableCache[T1, R])(f: (T1) ⇒ R): Memoize1[T1, R]

  28. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  29. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  30. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  33. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  34. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  35. final def isInstanceOf[T0]: Boolean

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

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

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

    Definition Classes
    AnyRef
  39. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  40. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any