GlobalMemoizedEffect

oxygen.zio.GlobalMemoizedEffect
See theGlobalMemoizedEffect companion class

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def cacheVal[E, A](underlyingEffect: IO[E, A]): IO[E, A]

Note, this should only be called when assigning the result to a global value. If not, the global cache ref will not be the same, and this does nothing.

Note, this should only be called when assigning the result to a global value. If not, the global cache ref will not be the same, and this does nothing.

--- good --- val res: UIO[Int] = GlobalMemoizedEffect.cacheVal { Random.nextInt }

--- bad --- def res: UIO[Int] = GlobalMemoizedEffect.cacheVal { Random.nextInt }

--- bad --- val res: UIO[Int] = for { _ <- ZIO.logInfo("logging") res <- GlobalMemoizedEffect.cacheVal { Random.nextInt } } yield res

Attributes

def make[E, A](underlyingEffect: IO[E, A]): GlobalMemoizedEffect[E, A]