Memory

public actor Memory<T> : Storage where T : Decodable, T : Encodable, T : Sendable

A storage for storing objects in memory, where T is the type of the object to be stored.

  • save(item:) Asynchronous

    Saves the given item in memory.

    Declaration

    Swift

    public func save(item: T) async throws

    Parameters

    item

    The item to save.

  • get() Asynchronous

    Retrieves the item from memory.

    Declaration

    Swift

    public func get() async throws -> T?

    Return Value

    The item if it exists, nil otherwise.

  • delete() Asynchronous

    Deletes the item from memory.

    Declaration

    Swift

    public func delete() async throws