Packages

case class Scaffeine[K, V](underlying: Caffeine[K, V]) extends Product with Serializable

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Scaffeine
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Scaffeine(underlying: Caffeine[K, V])

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def build[K1 <: K, V1 <: V](loader: (K1) => V1, allLoader: Option[(Iterable[K1]) => Map[K1, V1]] = None, reloadLoader: Option[(K1, V1) => V1] = None): LoadingCache[K1, V1]

    Builds a cache, which either returns an already-loaded value for a given key or atomically computes or retrieves it using the supplied loader.

    Builds a cache, which either returns an already-loaded value for a given key or atomically computes or retrieves it using the supplied loader. 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.

    K1

    the key type of the loader

    V1

    the value type of the loader

    loader

    the loader used to obtain new values

    allLoader

    the loader used to obtain new values in bulk, called by LoadingCache.getAll(keys:Iterable[K])*

    reloadLoader

    the loader used to obtain already-cached values

    returns

    a cache having the requested features

  6. def build[K1 <: K, V1 <: V](): Cache[K1, V1]

    Builds a cache which does not automatically load values when keys are requested.

    Builds a cache which does not automatically load values when keys are requested.

    K1

    the key type of the cache

    V1

    the value type of the cache

    returns

    a cache having the requested features

  7. def buildAsync[K1 <: K, V1 <: V](loader: (K1) => V1, allLoader: Option[(Iterable[K1]) => Map[K1, V1]] = None, reloadLoader: Option[(K1, V1) => V1] = None): AsyncLoadingCache[K1, V1]

    Builds a cache, which either returns a scala.concurrent.Future already loaded or currently computing the value for a given key, or atomically computes the value asynchronously through a supplied mapping function or the supplied loader.

    Builds a cache, which either returns a scala.concurrent.Future already loaded or currently computing the value for a given key, or atomically computes the value asynchronously through a supplied mapping function or the supplied loader. If the asynchronous computation fails then the entry will be automatically removed. Note that multiple threads can concurrently load values for distinct keys.

    K1

    the key type of the loader

    V1

    the value type of the loader

    loader

    the loader used to obtain new values

    allLoader

    the loader used to obtain new values in bulk, called by AsyncLoadingCache.getAll(keys:Iterable[K])*

    reloadLoader

    the loader used to obtain already-cached values

    returns

    a cache having the requested features

    Exceptions thrown

    java.lang.IllegalStateException if the value strength is weak or soft

  8. def buildAsync[K1 <: K, V1 <: V](): AsyncCache[K1, V1]

    Builds a cache which does not automatically load values when keys are requested unless a mapping function is provided.

    Builds a cache which does not automatically load values when keys are requested unless a mapping function is provided. The returned scala.concurrent.Future may be already loaded or currently computing the value for a given key. If the asynchronous computation fails value then the entry will be automatically removed. Note that multiple threads can concurrently load values for distinct keys.

    K1

    the key type of the cache

    V1

    the value type of the cache

    returns

    a cache having the requested features

  9. def buildAsyncFuture[K1 <: K, V1 <: V](loader: (K1) => Future[V1], allLoader: Option[(Iterable[K1]) => Future[Map[K1, V1]]] = None, reloadLoader: Option[(K1, V1) => Future[V1]] = None): AsyncLoadingCache[K1, V1]

    Builds a cache, which either returns a scala.concurrent.Future already loaded or currently computing the value for a given key, or atomically computes the value asynchronously through a supplied mapping function or the supplied async loader.

    Builds a cache, which either returns a scala.concurrent.Future already loaded or currently computing the value for a given key, or atomically computes the value asynchronously through a supplied mapping function or the supplied async loader. If the asynchronous computation fails then the entry will be automatically removed. Note that multiple threads can concurrently load values for distinct keys.

    K1

    the key type of the loader

    V1

    the value type of the loader

    loader

    the loader used to obtain new values

    allLoader

    the loader used to obtain new values in bulk, called by AsyncLoadingCache.getAll(keys:Iterable[K])*

    reloadLoader

    the loader used to obtain already-cached values

    Exceptions thrown

    java.lang.IllegalStateException if the value strength is weak or soft

  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def evictionListener[K1 <: K, V1 <: V](evictionListener: (K1, V1, RemovalCause) => Unit): Scaffeine[K1, V1]

    Specifies a listener instance that caches should notify each time an entry is evicted.

    Specifies a listener instance that caches should notify each time an entry is evicted.

    K1

    the key type of the listener

    V1

    the value type of the listener

    evictionListener

    a listener that caches should notify each time an entry is being automatically removed due to eviction

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if a removal listener was already set

  13. def executor(executor: Executor): Scaffeine[K, V]

    Specifies the executor to use when running asynchronous tasks.

    Specifies the executor to use when running asynchronous tasks.

    executor

    the executor to use for asynchronous execution

    returns

    this builder instance

  14. def expireAfter[K1 <: K, V1 <: V](create: (K1, V1) => FiniteDuration, update: (K1, V1, FiniteDuration) => FiniteDuration, read: (K1, V1, FiniteDuration) => FiniteDuration): Scaffeine[K1, V1]

    Specifies that each entry should be automatically removed from the cache once a duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.

    Specifies that each entry should be automatically removed from the cache once a duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.

    K1

    the key type of the expiry.

    V1

    the value type of the expiry.

    create

    the length of time an entry should be automatically removed from the cache after the entry's creation.

    update

    the length of time an entry should be automatically removed from the cache after the replacement of it's value.

    read

    the length of time an entry should be automatically removed from the cache after the entry's last read.

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if expiration was already set or used with expiresAfterAccess or expiresAfterWrite.

  15. def expireAfterAccess(duration: FiniteDuration): Scaffeine[K, V]

    Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.

    Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.

    duration

    the length of time after an entry is last accessed that it should be automatically removed

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException if duration is negative

    java.lang.IllegalStateException if the time to idle or time to live was already set

  16. def expireAfterWrite(duration: FiniteDuration): Scaffeine[K, V]

    Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.

    Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.

    duration

    the length of time after an entry is created that it should be automatically removed

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException if duration is negative

    java.lang.IllegalStateException if the time to live or time to idle was already set

  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. def initialCapacity(initialCapacity: Int): Scaffeine[K, V]

    Sets the minimum total size for the internal hash tables.

    Sets the minimum total size for the internal hash tables.

    initialCapacity

    minimum total size for the internal hash tables

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException if initialCapacity

    java.lang.IllegalStateException if an initial capacity was already set

  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def maximumSize(maximumSize: Long): Scaffeine[K, V]

    Specifies the maximum number of entries the cache may contain.

    Specifies the maximum number of entries the cache may contain.

    maximumSize

    the maximum size of the cache

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException size is negative

    java.lang.IllegalStateException if a maximum size or weight was already set

  21. def maximumWeight(maximumWeight: Long): Scaffeine[K, V]

    Specifies the maximum weight of entries the cache may contain.

    Specifies the maximum weight of entries the cache may contain.

    This feature cannot be used in conjunction with Scaffeine.maximumSize.

    maximumWeight

    the maximum total weight of entries the cache may contain

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException if maximumWeight is negative

    java.lang.IllegalStateException if a maximum weight or size was already set

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. def productElementNames: Iterator[String]
    Definition Classes
    Product
  26. def recordStats[C <: StatsCounter](statsCounterSupplier: () => C): Scaffeine[K, V]

    Enables the accumulation of com.github.benmanes.caffeine.cache.stats.CacheStats during the operation of the cache.

    Enables the accumulation of com.github.benmanes.caffeine.cache.stats.CacheStats during the operation of the cache.

    statsCounterSupplier

    a supplier that returns a new com.github.benmanes.caffeine.cache.stats.StatsCounter

    returns

    this builder instance

  27. def recordStats(): Scaffeine[K, V]

    Enables the accumulation of com.github.benmanes.caffeine.cache.stats.CacheStats during the operation of the cache.

    Enables the accumulation of com.github.benmanes.caffeine.cache.stats.CacheStats during the operation of the cache.

    returns

    this builder instance

  28. def refreshAfterWrite(duration: FiniteDuration): Scaffeine[K, V]

    Specifies that active entries are eligible for automatic refresh once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.

    Specifies that active entries are eligible for automatic refresh once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.

    duration

    the length of time after an entry is created that it should be considered stale, and thus eligible for refresh

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException if duration is negative

    java.lang.IllegalStateException if the refresh interval was already set

  29. def removalListener[K1 <: K, V1 <: V](removalListener: (K1, V1, RemovalCause) => Unit): Scaffeine[K1, V1]

    Specifies a listener instance that caches should notify each time an entry is removed for any com.github.benmanes.caffeine.cache.RemovalCause.

    Specifies a listener instance that caches should notify each time an entry is removed for any com.github.benmanes.caffeine.cache.RemovalCause.

    K1

    the key type of the listener

    V1

    the value type of the listener

    removalListener

    a listener that caches should notify each time an entry is removed

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if a removal listener was already set

  30. def scheduler(scheduler: Scheduler): Scaffeine[K, V]

    Specifies the scheduler to use when scheduling routine maintenance based on an expiration event.

    Specifies the scheduler to use when scheduling routine maintenance based on an expiration event. This augments the periodic maintenance that occurs during normal cache operations to allow for the prompt removal of expired entries regardless of whether any cache activity is occurring at that time. By default the scheduler is disabled.

    scheduler

    the scheduler that submits a task to the Scaffeine.executor* after a given delay

    returns

    this builder instance

  31. def softValues(): Scaffeine[K, V]

    Specifies that each value (not key) stored in the cache should be wrapped in a java.lang.ref.SoftReference (by default, strong references are used).

    Specifies that each value (not key) stored in the cache should be wrapped in a java.lang.ref.SoftReference (by default, strong references are used).

    This feature cannot be used in conjunction with Scaffeine.buildAsync[K1<:K,V1<:V]()*.

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if the value strength was already set

  32. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  33. def ticker(ticker: Ticker): Scaffeine[K, V]

    Specifies a nanosecond-precision time source for use in determining when entries should be expired or refreshed.

    Specifies a nanosecond-precision time source for use in determining when entries should be expired or refreshed. By default, java.lang.System.nanoTime is used.

    ticker

    a nanosecond-precision time source

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if a ticker was already set

  34. val underlying: Caffeine[K, V]
  35. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  38. def weakKeys(): Scaffeine[K, V]

    Specifies that each key (not value) stored in the cache should be wrapped in a java.lang.ref.WeakReference (by default, strong references are used).

    Specifies that each key (not value) stored in the cache should be wrapped in a java.lang.ref.WeakReference (by default, strong references are used).

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if the key strength was already set or the writer was set

  39. def weakValues(): Scaffeine[K, V]

    Specifies that each value (not key) stored in the cache should be wrapped in a java.lang.ref.WeakReference (by default, strong references are used).

    Specifies that each value (not key) stored in the cache should be wrapped in a java.lang.ref.WeakReference (by default, strong references are used).

    This feature cannot be used in conjunction with Scaffeine.buildAsync[K1<:K,V1<:V]()*.

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalStateException if the value strength was already set

  40. def weigher[K1 <: K, V1 <: V](weigher: (K1, V1) => Int): Scaffeine[K1, V1]

    Specifies the weigher to use in determining the weight of entries.

    Specifies the weigher to use in determining the weight of entries.

    K1

    key type of the weigher

    V1

    value type of the weigher

    weigher

    the weigher to use in calculating the weight of cache entries

    returns

    this builder instance

    Exceptions thrown

    java.lang.IllegalArgumentException if size is negative

    java.lang.IllegalStateException if a maximum size was already set

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped