DeviceIdentifierDelegate

A delegate that implements DeviceIdentifier and caches the result of the id() function.

This class ensures that the computationally expensive or slow id() call is only performed once. Subsequent calls will return the cached value instantly.

It uses a Mutex to guarantee thread-safe access to the cached ID, preventing race conditions in a concurrent environment.

Parameters

delegate

The actual DeviceIdentifier implementation to which the call is delegated on the first invocation.

Constructors

Link copied to clipboard
constructor(delegate: DeviceIdentifier)

Properties

Link copied to clipboard
open override val id: suspend () -> String

The suspend function that returns the device identifier.