BlueForge Docs

client.redis.set

Set a RedisOS key with optional TTL.

Signature

class Client {
  redis: {
    set(key: string, value: string, opts?: { ttl?: number }): Promise<void>
  }
}

Parameters

NameTypeRequiredNotes
key
stringyesRedis key name
value
stringyesValue to store
ttl
numbernoTime-to-live in seconds

Examples

await bf.redis.set('session:abc123', 'user_data', { ttl: 3600 })

Throws

ErrorCondition
ApiError
API request failed
NetworkError
Network issue

Pitfalls

  • String-only values — use JSON.stringify for complex objects
  • TTL overwrites — setting a new TTL on an existing key replaces the previous TTL

See also

{auto-injected}

Tested against

{auto-injected}