@botmesh/core - v2.0.0-alpha.2
    Preparing search index...

    Class MemoryStore

    Implements

    Index
    • Shallow-merge chat onto the stored record. An own field set to undefined UNSETS that field, so a partial upsert must omit what it does not know (the Bot does).

      Parameters

      Returns Promise<void>

    • Delivery cursor for long-poll/webhook transports (Telegram update_id).

      Parameters

      • key: string

      Returns Promise<string | undefined>

    • Compare-and-set (see IStore.setCheckpointIf): one synchronous step, so concurrent callers see one winner.

      Parameters

      Returns Promise<boolean>

    • Conditional delete: true when the row is absent, or its revision (0 without one) matched expectedRevision and it was deleted; false when a different revision is stored (the row is left untouched). Same atomicity rule as setCheckpointIf.

      Parameters

      • key: string
      • expectedRevision: number

      Returns Promise<boolean>

    • Read one entry. MUST return undefined when the entry is missing OR its expiresAt is <= Date.now() (lazy expiry — expired rows may still exist physically until purged).

      Parameters

      • userId: string
      • namespace: string
      • key: string

      Returns Promise<UserDataEntry | undefined>

    • Upsert one entry as a SINGLE atomic write that replaces both value and expiresAt (no read-modify-write inside the store). An entry whose expiresAt is already in the past may be dropped instead of written.

      Parameters

      Returns Promise<void>

    • Delete one key (namespace + key), one whole namespace (key omitted) or every namespace of the user (namespace omitted; key is then ignored). Deleting missing data is a no-op.

      Parameters

      • userId: string
      • Optionalnamespace: string
      • Optionalkey: string

      Returns Promise<void>

    • Physically remove entries whose expiresAt <= now (default Date.now()) across the whole store; resolves with how many were removed. Stores with native expiry (Redis) resolve 0.

      Parameters

      • now: number = ...

      Returns Promise<number>

    • get durable(): boolean

      true when this store mirrors itself to a JSON file, so its data (including persistent() flow checkpoints) survives a process restart. false = RAM only.

      Returns boolean