8000 Documented the dynamic lock refresh · symfony/symfony-docs@6597d4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 6597d4e

Browse files
committed
Documented the dynamic lock refresh
1 parent 8f123c6 commit 6597d4e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

components/lock.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@ to reset the TTL to its original value::
143143
$lock->release();
144144
}
145145

146+
.. tip::
147+
148+
Another useful technique for long-running tasks is to pass a custom TTL as
149+
an argument of the ``refresh()`` method to change the default lock TTL::
150+
151+
$lock = $factory->createLock('charts-generation', 30);
152+
// ...
153+
// refresh the lock for 30 seconds
154+
$lock->refresh();
155+
// ...
156+
// refresh the lock for 600 seconds (next refresh() call will be 30 seconds again)
157+
$lock->refresh(600);
158+
159+
.. versionadded:: 4.1
160+
The feature to pass a custom TTL as an argument of the ``refresh()``
161+
method was introduced in Symfony 4.1.
162+
146163
Available Stores
147164
----------------
148165

0 commit comments

Comments
 (0)
0