ts-algochat
    Preparing search index...

    Interface LegacyMessageCache

    Protocol for message caching

    Implementations can use in-memory storage, IndexedDB, or other backends.

    interface LegacyMessageCache {
        clear(participant: string): void;
        clearAll(): void;
        get(messageId: string): Message | undefined;
        getLastSyncRound(participant: string): number | undefined;
        getParticipants(): string[];
        has(messageId: string): boolean;
        retrieve(participant: string): Message[];
        retrieveAfter(participant: string, afterRound: number): Message[];
        setLastSyncRound(participant: string, round: number): void;
        store(participant: string, message: Message): void;
        storeMany(participant: string, messages: Message[]): void;
    }
    Index

    Methods

    • Removes all messages for a participant

      Parameters

      • participant: string

        Address of the conversation participant

      Returns void

    • Gets the last synced round for a participant

      Parameters

      • participant: string

        Address of the conversation participant

      Returns number | undefined

      The last synced round, or undefined if never synced

    • Checks if a message exists in the cache

      Parameters

      • messageId: string

        Transaction ID of the message

      Returns boolean

    • Retrieves all cached messages for a participant

      Parameters

      • participant: string

        Address of the conversation participant

      Returns Message[]

      Array of messages sorted by timestamp

    • Retrieves messages after a specific round

      Parameters

      • participant: string

        Address of the conversation participant

      • afterRound: number

        Minimum confirmed round (exclusive)

      Returns Message[]

      Array of messages with confirmedRound > afterRound

    • Sets the last synced round for a participant

      Parameters

      • participant: string

        Address of the conversation participant

      • round: number

        The round number

      Returns void

    • Stores a message in the cache

      Parameters

      • participant: string

        Address of the conversation participant

      • message: Message

        Message to store

      Returns void

    • Stores multiple messages in the cache

      Parameters

      • participant: string

        Address of the conversation participant

      • messages: Message[]

        Messages to store

      Returns void