GlobalLayer

oxygen.zio.GlobalLayer
See theGlobalLayer companion class
object GlobalLayer

Attributes

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

Members list

Value members

Concrete methods

def cacheVal[E, A](underlyingLayer: Layer[E, A]): Layer[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: ULayer[Int] = GlobalLayer.cacheVal { ZLayer { Random.nextInt } }

--- bad --- def res: ULayer[Int] = GlobalLayer.cacheVal { ZLayer { Random.nextInt } }

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

Attributes

def make[E, A](underlyingLayer: Layer[E, A]): GlobalLayer[E, A]