You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,6 +158,10 @@ Get a value from the database by `key`. The optional `options` object may contai
158
158
159
159
Returns a promise for the value. If the `key` was not found then the value will be `undefined`.
160
160
161
+
### `db.getSync(key[, options])`
162
+
163
+
Synchronously get a value from the database by `key`. This blocks the event loop but can be significantly faster than `db.get()`. Options are the same. Returns the value, or `undefined` if not found.
164
+
161
165
### `db.getMany(keys[, options])`
162
166
163
167
Get multiple values from the database by an array of `keys`. The optional `options` object may contain:
@@ -1509,6 +1513,12 @@ If the database indicates support of snapshots via `db.supports.implicitSnapshot
1509
1513
1510
1514
The default `_get()` returns a promise for an `undefined` value. It must be overridden.
1511
1515
1516
+
### `db._getSync(key, options)`
1517
+
1518
+
Synchronously get a value by `key`. Receives the same options as `db._get()`. Must return a value, or `undefined` if not found.
1519
+
1520
+
The default `_getSync()` throws a [`LEVEL_NOT_SUPPORTED`](#level_not_supported) error. It should be overridden but support of `_getSync()` is currently opt-in. Set `manifest.getSync` to `true` in order to enable tests.
1521
+
1512
1522
### `db._getMany(keys, options)`
1513
1523
1514
1524
Get multiple values by an array of `keys`. The `options` object will always have the following properties: `keyEncoding` and `valueEncoding`. Must return a promise. If an error occurs, reject the promise. Otherwise resolve the promise with an array of values. If a key does not exist, set the relevant value to `undefined`.
0 commit comments