BlueForge Docs

client.redis.batch

Execute batch RedisOS operations atomically.

Signature

class Client {
  redis: {
    batch(ops: BatchOp[]): Promise<BatchResultEntry[]>
  }
}

type BatchOp =
  | { type: 'get'; key: string }
  | { type: 'set'; key: string; value: string; ttl?: number }
  | { type: 'del'; key: string }
  | { type: 'incr'; key: string; by?: number }

Parameters

NameTypeRequiredNotes
ops
BatchOp[]yesArray of operations to execute

Examples

const results = await bf.redis.batch([
  { type: 'get', key: 'a' },
  { type: 'set', key: 'b', value: '2' },
  { type: 'incr', key: 'c', by: 1 },
])

Throws

ErrorCondition
ApiError
API request failed
NetworkError
Network issue

Pitfalls

  • Atomicity — all operations execute atomically; if any fail, the entire batch is rolled back
  • Batch size — maximum 100 operations per batch

See also

{auto-injected}

Tested against

{auto-injected}