ZCaffeine

object ZCaffeine
Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

object State
Companion:
class
sealed trait State

Represents the current state of the com.stuart.zcaffeine.ZCaffeine cache builder.

Represents the current state of the com.stuart.zcaffeine.ZCaffeine cache builder.

Used in combination with State.Conflict to restrict incompatible configurations of the underlying com.github.benmanes.caffeine.cache.Caffeine builder, like configuring both max size and max weight.

Note: using ZCaffeine.fromCaffeineSpec breaks those checks, as we don’t know for sure what has been already configured.

Companion:
object

Value members

Concrete methods

def apply[R <: Clock, Key, Value](): URIO[R, ZCaffeine[R, Unconfigured, Key, Value]]

Create a new ZCaffeine cache builder, with all defaults settings from Caffeine.newBuilder.

Create a new ZCaffeine cache builder, with all defaults settings from Caffeine.newBuilder.

Type parameters:
Key

Type of the cache keys

R

the ZIO environment used for effects interacting with the cache

Value

Type of the cache values

Returns:

an unconfigured ZCaffeine cache builder

def fromCaffeineSpec[R <: Clock, Key, Value](caffeineSpec: String): RIO[R, ZCaffeine[R, Unconfigured, Key, Value]]

Create a new ZCaffeine cache builder, preconfigured from the string representation of a CaffeineSpec. Compared to other variants, this can fail if the spec string is invalid.

Create a new ZCaffeine cache builder, preconfigured from the string representation of a CaffeineSpec. Compared to other variants, this can fail if the spec string is invalid.

Note: this variant breaks the checks offered by State & State.Conflict, as we can’t know for sure what has been already configured.

Type parameters:
Key

Type of the cache keys

R

the ZIO environment used for effects interacting with the cache

Value

Type of the cache values

Returns:

an preconfigured ZCaffeine cache builder

def fromCaffeineSpec[R <: Clock, Key, Value](caffeineSpec: CaffeineSpec): URIO[R, ZCaffeine[R, Unconfigured, Key, Value]]

Create a new ZCaffeine cache builder, preconfigured from a CaffeineSpec.

Create a new ZCaffeine cache builder, preconfigured from a CaffeineSpec.

Note: this variant breaks the checks offered by State & State.Conflict, as we can’t know for sure what has been already configured.

Type parameters:
Key

Type of the cache keys

R

the ZIO environment used for effects interacting with the cache

Value

Type of the cache values

Returns:

an unconfigured ZCaffeine cache builder