File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed
doc/reference/reference_lua Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,12 @@ Below is a list of all functions and pages related to watchers or events.
6464 * - Name
6565 - Use
6666
67- * - :doc: ` ./box_events/ watch `
67+ * - :ref: ` box. watch() < box-watch > `
6868 - Create a local watcher.
6969
70+ * - :ref: `box.watch_once() <box-watch >`
71+ - Get the current key value.
72+
7073 * - :ref: `conn:watch() <conn-watch >`
7174 - Create a watcher for the remote host.
7275
@@ -80,5 +83,6 @@ Below is a list of all functions and pages related to watchers or events.
8083 :hidden:
8184
8285 box_events/watch
86+ box_events/watch_once
8387 box_events/broadcast
8488 box_events/system_events
Original file line number Diff line number Diff line change 1+ .. _box-watch_once :
2+
3+ box.watch_once()
4+ ================
5+
6+ .. function :: box.watch_once(key, func)
7+
8+ Returns the current value of a given notification key.
9+ The function can be used as an alternative to :ref: `box.watch() <box-watch >`
10+ when the caller only needs the current value without subscribing to future changes.
11+
12+ :param string key: key name
13+
14+ :return: the key value
15+
16+ To read more about watchers, see the :ref: `box-watchers ` section.
17+
18+ **Example: **
19+
20+ .. code-block :: lua
21+
22+ -- Broadcast value 42 for the 'foo' key.
23+ box.broadcast('foo', 42)
24+
25+ -- Get the value of this key
26+ tarantool> box.watch_once('foo')
27+ ---
28+ - 42
29+ ...
30+
31+ -- Non-existent keys' values are empty
32+ tarantool> box.watch_once('none')
33+ ---
34+ ...
35+
36+
37+
You can’t perform that action at this time.
0 commit comments