Members
connected :boolean
Is the connection active?
Type:
- boolean
db
Database object.
Don't use this directly unless necessary
Methods
(async) del(key)
Deletes a key
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key to delete |
ensureReady() → {Promise.<Boolean>}
Returns a Promise that resolves either when the Redis connection
or the fallback cache are ready
Returns:
- Type
- Promise.<Boolean>
(async) get(key) → {object}
Gets an object by its key
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key to find |
Returns:
- Type
- object
(async) set(key, val)
Sets the value of a key
NOTE: Objects get converted to JSON before saving
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key to set |
val |
object | New value |
subscribe(key, handler) → {Gun}
Subscribes to a key and listens for changes
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key |
handler |
function | Event handler |
Returns:
- Gun chain
- Type
- Gun