Packages

object Cache

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Cache
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. implicit final class CacheOps[F[_], K, V] extends AnyVal
  2. sealed trait Directive[+F[_], +V] extends AnyRef

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 clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  6. def empty[F[_], K, V](implicit arg0: Monad[F]): Cache[F, K, V]

    Creates an always-empty implementation of cache.

    Creates an always-empty implementation of cache.

    The implementation *almost* always returns scala.None regardess the key. The notable exception are Cache#getOrUpdate, Cache#getOrUpdate1 and Cache#getOrUpdateOpt methods, which return the value passed to them to ensure the consistent behavior (i.e. it could be a suprise if someone calls Cache#getOrUpdateOpt with scala.Some and gets scala.None as a result).

    It is meant to be used in tests, or as a stub in the code where cache should be disabled.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def expiring[F[_], K, V](config: Config[F, K, V], partitions: Option[Int] = None)(implicit arg0: Temporal[F], arg1: Runtime[F], arg2: Parallel[F]): Resource[F, Cache[F, K, V]]

    Creates a cache implementation, which is able remove the stale values.

    Creates a cache implementation, which is able remove the stale values.

    The underlying storage implementation is the same as in #loading[F[_],K,V](partitions:Option[Int])*, but the expiration routines are added on top of it.

    Besides a value expiration leading to specific key being removed from the cache, the implementation is capable of _refreshing_ the values instead of removing them, which might be useful if the cache is used as a wrapper for setting or configuration service. The feature is possible to configure using config parameter.

    In adddition to context bounds used in #loading[F[_],K,V](partitions:Option[Int])*, this implementation also adds cats.effect.Clock (as part of cats.effect.Temporal), to have the ability to schedule cache clean up in a concurrent way.

    Minimal usage example:

    Cache.expiring[F, String, User](
      config = ExpiringCache.Config(expireAfterRead = 1.minute),
      partitions = None,
    )
    F

    Effect type. See #loading[F[_],K,V](partitions:Option[Int])* and Cache for more details.

    K

    Key type. See Cache for more details.

    V

    Value type. See Cache for more details.

    config

    Cache configuration. See ExpiringCache.Config for more details on what parameters could be configured.

    partitions

    Number of partitions to use, or scala.None in case number of partitions should be determined automatically using passed Runtime implementation.

    returns

    A new instance of a cache wrapped into cats.effect.Resource. Note, that Cache#clear method will be called on underlying cache when resource is released to make sure all resources stored in a cache are also released.

  10. def fromPartitions[F[_], K, V](partitions: Partitions[K, Cache[F, K, V]])(implicit arg0: MonadThrow[F], arg1: Parallel[F]): Cache[F, K, V]

    Creates Cache interface to a set of precreated caches.

    Creates Cache interface to a set of precreated caches.

    This method is required to use common partitioning implementation for various caches and is not intended to be called directly. Cache partitioning itself allows splitting underlying cache into multiple partitions, so there is no contention on a single cats.effect.Ref when cache need to be updated.

    It is only left public for sake of backwards compatibility.

    Please consider using either #loading[F[_],K,V](partitions:Option[Int])* or #expiring instead.

    Here is a short description of why some of the context bounds are required on F[_]:

  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def loading[F[_], K, V](partitions: Option[Int] = None)(implicit arg0: Concurrent[F], arg1: Parallel[F], arg2: Runtime[F]): Resource[F, Cache[F, K, V]]

    Creates a cache implementation, which is able to load the missing values.

    Creates a cache implementation, which is able to load the missing values.

    To speed the operations, the cache may use several partitions each of whom may be accessed in parallel.

    Note, that the values getting into this cache never expire, i.e. the cache will grow indefinetely unless Cache#remove is called. See #expiring for the implementation, which allows automatic expriation of the values.

    Here is a short description of why some of the context bounds are required on F[_]:

    Minimal usage example:

    Cache.loading[F, String, User](partitions = None)
    F

    Effect type. See Cache for more details.

    K

    Key type. See Cache for more details.

    V

    Value type. See Cache for more details.

    partitions

    Number of partitions to use, or scala.None in case number of partitions should be determined automatically using passed Runtime implementation.

    returns

    A new instance of a cache wrapped into cats.effect.Resource. Note, that Cache#clear method will be called on underlying cache when resource is released to make sure all resources stored in a cache are also released.

  15. def loading[F[_], K, V](partitions: Int)(implicit arg0: Concurrent[F], arg1: Parallel[F], arg2: Runtime[F]): Resource[F, Cache[F, K, V]]

    Creates a cache implementation, which is able to load the missing values.

    Creates a cache implementation, which is able to load the missing values.

    Same as #loading[F[_],K,V](partitions:Option[Int])*, but without the need to use Option.

    Minimal usage example:

    Cache.loading[F, String, User](partitions = 8)
    returns

    A new instance of a cache wrapped into cats.effect.Resource. Note, that Cache#clear method will be called on underlying cache when resource is released to make sure all resources stored in a cache are also released.

  16. def loading[F[_], K, V](implicit arg0: Concurrent[F], arg1: Parallel[F], arg2: Runtime[F]): Resource[F, Cache[F, K, V]]

    Creates a cache implementation, which is able to load the missing values.

    Creates a cache implementation, which is able to load the missing values.

    Same as #loading[F[_],K,V](partitions:Int)*, but with number of paritions determined automatically using passed Runtime implementation.

    Minimal usage example:

    Cache.loading[F, String, User]
    returns

    A new instance of a cache wrapped into cats.effect.Resource. Note, that Cache#clear method will be called on underlying cache when resource is released to make sure all resources stored in a cache are also released.

  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. object Directive

Deprecated Value Members

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

Inherited from AnyRef

Inherited from Any

Ungrouped