MapRef

cats.effect.std.MapRef
See theMapRef companion object
trait MapRef[F[_], K, V] extends K => Ref[F, V]

This is a total map from K to Ref[F, V].

It is conceptually similar to a Ref[F, Map[K, V]], but with better ergonomics when working on a per key basis. Note, however, that it does not support atomic updates to multiple keys.

Additionally, some implementations also provide less contention: since all operations are performed on individual key-value pairs, the pairs can be sharded by key. Thus, multiple concurrent updates may be executed independently to each other, as long as their keys belong to different shards.

Attributes

Companion:
object
Source:
MapRef.scala
Graph
Supertypes
trait K => Ref[F, V]
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Abstract methods

def apply(k: K): Ref[F, V]

Access the reference for this Key

Access the reference for this Key

Attributes

Source:
MapRef.scala

Concrete methods

def getAndSetKeyValue(k: K, v: V): F[Option[V]]
Implicitly added by mapRefOptionSyntax

Attributes

Source:
MapRef.scala
def modifyKeyValueIfSet[B](k: K, f: V => (V, B)): F[Option[B]]
Implicitly added by mapRefOptionSyntax

Attributes

Source:
MapRef.scala
def setKeyValue(k: K, v: V): F[Unit]
Implicitly added by mapRefOptionSyntax

Attributes

Source:
MapRef.scala
def unsetKey(k: K): F[Unit]
Implicitly added by mapRefOptionSyntax

Attributes

Source:
MapRef.scala
def updateKeyValueIfSet(k: K, f: V => V): F[Unit]
Implicitly added by mapRefOptionSyntax

Attributes

Source:
MapRef.scala

Inherited methods

def andThen[A](g: Ref[F, V] => A): T1 => A

Attributes

Inherited from:
Function1
def compose[A](g: A => K): A => R

Attributes

Inherited from:
Function1
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1