MemoryPersistDriver
In memory driver for persist system for storing persistent cross request key/value pairs
actor MemoryPersistDriver<C> where C : Clock, C.Duration == DurationIn memory driver for persist system for storing persistent cross request key/value pairs
actor MemoryPersistDriver<C> where C : Clock, C.Duration == Durationimport Hummingbirdprotocol Clock<Duration> : SendableA mechanism in which to measure time, and delay work until a given point in time.
associatedtype Duration where Self.Duration == Self.Instant.Duration@frozen struct DurationA representation of high precision time.
protocol Actor : AnyObject, SendableCommon protocol to which all actors conform.
protocol PersistDriver : ServiceProtocol for driver supporting persistent Key/Value pairs across requests
protocol SendableA thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.
init(_ clock: C = .continuous) Initialize MemoryPersistDriver
init(_ clock: C = .continuous, configuration: MemoryPersistDriver<C>.Configuration = .init()) Initialize MemoryPersistDriver
func create(key: String, value: some Decodable & Encodable & Sendable, expires: Duration?) async throws func get<Object>(key: String, as: Object.Type) async throws -> Object? where Object : Decodable, Object : Encodable, Object : Sendable func remove(key: String) async throws func run() async throws func set(key: String, value: some Decodable & Encodable & Sendable, expires: Duration?) async throws struct Configuration@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.
func create(key: String, value: some Decodable & Encodable & Sendable) async throws create key/value pair. If key already exist throw PersistError.duplicate error
@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.
func set(key: String, value: some Decodable & Encodable & Sendable) async throws set value for key. If value already exists overwrite it
func shutdown() async throws default implemenation of shutdown()