AsyncLazyExpiring
A value that periodically expires and gets re-queried through a supplied getter.
actor AsyncLazyExpiring<T>
A value that periodically expires and gets re-queried through a supplied getter.
actor AsyncLazyExpiring<T>
import Utils
protocol Actor : AnyObject, Sendable
Common protocol to which all actors conform.
protocol Sendable
init(in expiryInterval: TimeInterval = 1.0, wrappedValue getter: @escaping () async throws -> T)
let expiryInterval: TimeInterval
var nextExpiry: Date? { get }
var wrappedValue: T { get async throws }
@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)
nonisolated func assertIsolated(_ message: @autoclosure () -> String = String(), file: StaticString = #fileID, line: UInt = #line)
Stops program execution if the current task is not executing on this actor’s serial executor.
nonisolated func assumeIsolated<T>(_ operation: (isolated Self) throws -> T, file: StaticString = #fileID, line: UInt = #line) rethrows -> T where T : Sendable
Assume that the current task is executing on this actor’s serial executor, or stop program execution otherwise.
@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)
nonisolated func preconditionIsolated(_ message: @autoclosure () -> String = String(), file: StaticString = #fileID, line: UInt = #line)
Stops program execution if the current task is not executing on this actor’s serial executor.