Nexus API Reference

Mdc
in package

FinalYes
Tags
psalm-suppress

MixedAssignment — MDC values are intentionally mixed.

Table of Contents

Methods

clearStatic()  : void
Clear ONLY the static tier. Coroutine contexts are cleared automatically when the coroutine ends.
get()  : mixed
getAll()  : array<string, mixed>
Merge of static + coroutine tiers. Coroutine values override static.
put()  : void
putStatic()  : void
Always writes to the thread/process-static tier, bypassing any coroutine context. Use for boot-time process info (host, pid, threadId, service) that should survive across all requests on this thread.
remove()  : void
scope()  : T
Scoped MDC override. Sets each key, runs $fn, restores previous values (or removes them) in a finally block.

Methods

clearStatic()

Clear ONLY the static tier. Coroutine contexts are cleared automatically when the coroutine ends.

public static clearStatic() : void

get()

public static get(string $key) : mixed
Parameters
$key : string

getAll()

Merge of static + coroutine tiers. Coroutine values override static.

public static getAll() : array<string, mixed>
Return values
array<string, mixed>

put()

public static put(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

putStatic()

Always writes to the thread/process-static tier, bypassing any coroutine context. Use for boot-time process info (host, pid, threadId, service) that should survive across all requests on this thread.

public static putStatic(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

remove()

public static remove(string $key) : void
Parameters
$key : string

scope()

Scoped MDC override. Sets each key, runs $fn, restores previous values (or removes them) in a finally block.

public static scope(array<string, mixed> $values, callable(): T $fn) : T
Parameters
$values : array<string, mixed>
$fn : callable(): T
Tags
template

T

Return values
T

        
On this page

Search results