MapRef

cats.effect.std.MapRef$
See theMapRef companion trait
object MapRef

Attributes

Companion:
trait
Source:
MapRef.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
MapRef.type

Members list

Concise view

Type members

Classlikes

final class MapRefOptionOps[F[_], K, V]

Attributes

Source:
MapRef.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def defaultedMapRef[F[_] : Functor, K, A : Eq](mapref: MapRef[F, K, Option[A]], default: A): MapRef[F, K, A]

Attributes

Source:
MapRef.scala
def defaultedRef[F[_] : Functor, A : Eq](ref: Ref[F, Option[A]], default: A): Ref[F, A]

Operates with default and anytime default is present instead information is removed from underlying ref. This is very useful as a default state can be used to prevent space leaks over high arity maprefs.

Operates with default and anytime default is present instead information is removed from underlying ref. This is very useful as a default state can be used to prevent space leaks over high arity maprefs.

Also useful for anytime a shared storage location is used for a ref, i.e. DB or Redis to not waste space. // Some(default) -- None

Attributes

Source:
MapRef.scala
def fromConcurrentHashMap[F[_] : Sync, K, V](map: ConcurrentHashMap[K, V]): MapRef[F, K, Option[V]]

Takes a ConcurrentHashMap, giving you access to the mutable state from the constructor.

Takes a ConcurrentHashMap, giving you access to the mutable state from the constructor.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def fromScalaConcurrentMap[F[_] : Sync, K, V](map: Map[K, V]): MapRef[F, K, Option[V]]

Takes a scala.collection.concurrent.Map, giving you access to the mutable state from the constructor.

Takes a scala.collection.concurrent.Map, giving you access to the mutable state from the constructor.

Attributes

Source:
MapRef.scala
def fromSeqRefs[F[_] : Functor, K, V](seq: Seq[Ref[F, Map[K, V]]]): MapRef[F, K, Option[V]]

Creates a sharded map ref from a sequence of refs.

Creates a sharded map ref from a sequence of refs.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def fromSingleImmutableMapRef[F[_] : Functor, K, V](ref: Ref[F, Map[K, V]]): MapRef[F, K, Option[V]]

Heavy Contention on Use, Allows you to access the underlying map through processes outside of this interface. Useful for Atomic Map[K, V] => Map[K, V] interactions.

Heavy Contention on Use, Allows you to access the underlying map through processes outside of this interface. Useful for Atomic Map[K, V] => Map[K, V] interactions.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def inConcurrentHashMap[G[_] : Sync, F[_] : Sync, K, V](initialCapacity: Int, loadFactor: Float, concurrencyLevel: Int): G[MapRef[F, K, Option[V]]]

This allocates mutable memory, so it has to be inside F. The way to use things like this is to allocate one then .map them inside of constructors that need to access them.

This allocates mutable memory, so it has to be inside F. The way to use things like this is to allocate one then .map them inside of constructors that need to access them.

It is usually a mistake to have a G[RefMap[F, K, V]] field. You want RefMap[F, K, V] field which means the thing that needs it will also have to be inside of F[_], which is because it needs access to mutable state so allocating it is also an effect.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def inShardedImmutableMap[G[_] : Sync, F[_] : Sync, K, V](shardCount: Int): G[MapRef[F, K, Option[V]]]

Creates a sharded map ref to reduce atomic contention on the Map, given an efficient and equally distributed hash, the contention should allow for interaction like a general datastructure. Created in G, operates in F.

Creates a sharded map ref to reduce atomic contention on the Map, given an efficient and equally distributed hash, the contention should allow for interaction like a general datastructure. Created in G, operates in F.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def inSingleImmutableMap[G[_] : Sync, F[_] : Sync, K, V](map: Map[K, V]): G[MapRef[F, K, Option[V]]]

Heavy Contention on Use. Created in G, operates in F.

Heavy Contention on Use. Created in G, operates in F.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def ofConcurrentHashMap[F[_] : Sync, K, V](initialCapacity: Int, loadFactor: Float, concurrencyLevel: Int): F[MapRef[F, K, Option[V]]]

This allocates mutable memory, so it has to be inside F. The way to use things like this is to allocate one then .map them inside of constructors that need to access them.

This allocates mutable memory, so it has to be inside F. The way to use things like this is to allocate one then .map them inside of constructors that need to access them.

It is usually a mistake to have a F[RefMap[F, K, V]] field. You want RefMap[F, K, V] field which means the thing that needs it will also have to be inside of F[_], which is because it needs access to mutable state so allocating it is also an effect.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def ofShardedImmutableMap[F[_] : Concurrent, K, V](shardCount: Int): F[MapRef[F, K, Option[V]]]

Creates a sharded map ref to reduce atomic contention on the Map, given an efficient and equally distributed hash, the contention should allow for interaction like a general datastructure.

Creates a sharded map ref to reduce atomic contention on the Map, given an efficient and equally distributed hash, the contention should allow for interaction like a general datastructure.

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala
def ofSingleImmutableMap[F[_] : Concurrent, K, V](map: Map[K, V]): F[MapRef[F, K, Option[V]]]

Heavy Contention on Use

Heavy Contention on Use

This uses universal hashCode and equality on K.

Attributes

Source:
MapRef.scala

Implicits

Implicits

implicit def mapRefInvariant[F[_] : Functor, K]: Invariant[[_] =>> MapRef[F, K, _$33]]

Attributes

Source:
MapRef.scala
implicit def mapRefOptionSyntax[F[_], K, V](mRef: MapRef[F, K, Option[V]]): MapRefOptionOps[F, K, V]

Attributes

Source:
MapRef.scala