client.redis.del
Delete a RedisOS key.
Signature
class Client {
redis: {
del(key: string): Promise<boolean>
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| string | yes | Redis key name |
Returns
true if the key existed and was deleted, false if the key did not exist.
Examples
const deleted = await bf.redis.del('session:abc123')
console.log(deleted ? 'Deleted' : 'Key not found')
Throws
| Error | Condition |
|---|---|
| API request failed |
| Network issue |
Pitfalls
- Non-existent keys — deleting a key that doesn't exist returns
, not an errorfalse - Irreversible — there is no undo for
del
See also
{auto-injected}
Tested against
{auto-injected}