RedisRef

io.chrisdavenport.rediculous.concurrent.RedisRef$.RedisRef
class RedisRef[F[_]](redisConnection: RedisConnection[F], key: String)(implicit evidence$2: Async[F]) extends Ref[F, String]

Attributes

Source:
RedisRef.scala
Graph
Supertypes
class Ref[F, String]
trait RefSink[F, String]
trait RefSource[F, String]
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def access: F[(String, String => F[Boolean])]

Obtains a snapshot of the current value, and a setter for updating it.

Obtains a snapshot of the current value, and a setter for updating it.

The setter attempts to modify the contents from the snapshot to the new value (and return true). If it cannot do this (because the contents changed since taking the snapshot), the setter is a noop and returns false.

Satisfies: r.access.map(_._1) == r.get and r.access.flatMap { case (v, setter) => setter(f(v)) } == r.tryUpdate(f).map(_.isDefined).

Attributes

Source:
RedisRef.scala
def get: F[String]

Obtains the current value.

Obtains the current value.

Since Ref is always guaranteed to have a value, the returned action completes immediately after being bound.

Attributes

Source:
RedisRef.scala
def modify[B](f: String => (String, B)): F[B]

Like tryModify but retries until the update has been successfully made.

Like tryModify but retries until the update has been successfully made.

Attributes

Source:
RedisRef.scala
def modifyState[B](state: State[String, B]): F[B]

Like tryModifyState but retries the modification until successful.

Like tryModifyState but retries the modification until successful.

Attributes

Source:
RedisRef.scala
def set(a: String): F[Unit]

Sets the current value to a.

Sets the current value to a.

The returned action completes after the reference has been successfully set.

Attributes

Source:
RedisRef.scala
def tryModify[B](f: String => (String, B)): F[Option[B]]

Like tryUpdate but allows the update function to return an output value of type B. The returned action completes with None if the value is not updated successfully and Some(b) otherwise.

Like tryUpdate but allows the update function to return an output value of type B. The returned action completes with None if the value is not updated successfully and Some(b) otherwise.

Attributes

Source:
RedisRef.scala
def tryModifyState[B](state: State[String, B]): F[Option[B]]

Update the value of this Ref with a state computation.

Update the value of this Ref with a state computation.

The current value of this Ref is used as the initial state and the computed output state is stored in this Ref after computation completes. If a concurrent modification occurs, None is returned.

Attributes

Source:
RedisRef.scala

Attempts to modify the current value once, returning false if another concurrent modification completes between the time the variable is read and the time it is set.

Attempts to modify the current value once, returning false if another concurrent modification completes between the time the variable is read and the time it is set.

Attributes

Source:
RedisRef.scala
def update(f: String => String): F[Unit]

Modifies the current value using the supplied update function. If another modification occurs between the time the current value is read and subsequently updated, the modification is retried using the new value. Hence, f may be invoked multiple times.

Modifies the current value using the supplied update function. If another modification occurs between the time the current value is read and subsequently updated, the modification is retried using the new value. Hence, f may be invoked multiple times.

Satisfies: r.update(_ => a) == r.set(a)

Attributes

Source:
RedisRef.scala

Inherited methods

def getAndSet(a: String): F[A]

Replaces the current value with a, returning the previous value.

Replaces the current value with a, returning the previous value.

Attributes

Inherited from:
Ref
Source:
Ref.scala
def getAndUpdate(f: String => String): F[A]

Updates the current value using f and returns the previous value.

Updates the current value using f and returns the previous value.

In case of retries caused by concurrent modifications, the returned value will be the last one before a successful update.

Attributes

Inherited from:
Ref
Source:
Ref.scala
def mapK[G[_]](f: FunctionK[F, G])(implicit F: Functor[F]): Ref[G, A]

Modify the context F using transformation f.

Modify the context F using transformation f.

Attributes

Inherited from:
Ref
Source:
Ref.scala
def updateAndGet(f: String => String): F[A]

Updates the current value using f, and returns the updated value.

Updates the current value using f, and returns the updated value.

Attributes

Inherited from:
Ref
Source:
Ref.scala