Class/Object

com.github.blemale.scaffeine

Scaffeine

Related Docs: object Scaffeine | package scaffeine

Permalink

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. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

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

    Permalink

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    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]

    Permalink

    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

    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]

    Permalink

    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]

    Permalink

    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

    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 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)(implicit ec: ExecutionContext): AsyncLoadingCache[K1, V1]

    Permalink

    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

    reloadLoader

    the loader used to obtain already-cached values

    Exceptions thrown

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

  9. def clone(): AnyRef

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

    Permalink
    Definition Classes
    AnyRef
  11. def executor(executor: Executor): Scaffeine[K, V]

    Permalink

    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

  12. def expireAfterAccess(duration: Duration): Scaffeine[K, V]

    Permalink

    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

  13. def expireAfterWrite(duration: Duration): Scaffeine[K, V]

    Permalink

    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

  14. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def initialCapacity(initialCapacity: Int): Scaffeine[K, V]

    Permalink

    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

  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def maximumSize(maximumSize: Long): Scaffeine[K, V]

    Permalink

    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

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

    Permalink

    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

  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def recordStats[C <: StatsCounter](statsCounterSupplier: () ⇒ C): Scaffeine[K, V]

    Permalink

    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

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

    Permalink

    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

  25. def refreshAfterWrite(duration: Duration): Scaffeine[K, V]

    Permalink

    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

  26. def removalListener[K1 <: K, V1 <: V](removalListener: (K1, V1, RemovalCause) ⇒ Unit): Scaffeine[K1, V1]

    Permalink

    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

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

    Permalink

    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.

    returns

    this builder instance

    Exceptions thrown

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

  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  29. def ticker(ticker: Ticker): Scaffeine[K, V]

    Permalink

    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

  30. val underlying: Caffeine[K, V]

    Permalink
  31. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def weakKeys(): Scaffeine[K, V]

    Permalink

    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).

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

    returns

    this builder instance

    Exceptions thrown

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

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

    Permalink

    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.

    returns

    this builder instance

    Exceptions thrown

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

  36. def weigher[K1 <: K, V1 <: V](weigher: (K1, V1) ⇒ Int): Scaffeine[K1, V1]

    Permalink

    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

  37. def writer[K1 <: K, V1 <: V](writer: CacheWriter[K1, V1]): Scaffeine[K1, V1]

    Permalink

    Specifies a writer instance that caches should notify each time an entry is explicitly created or modified, or removed for any com.github.benmanes.caffeine.cache.RemovalCause.

    Specifies a writer instance that caches should notify each time an entry is explicitly created or modified, or removed for any com.github.benmanes.caffeine.cache.RemovalCause.

    This feature cannot be used in conjunction with Scaffeine.weakKeys or Scaffeine.buildAsync.

    K1

    the key type of the writer

    V1

    the value type of the writer

    writer

    a writer instance that caches should notify each time an entry is explicitly created or modified, or removed for any reason

    returns

    this builder instance

    Exceptions thrown

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

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped