8000 minor #9399 Documented the dynamic lock refresh (javiereguiluz) · symfony/symfony-docs@a294625 · GitHub
[go: up one dir, main page]

Skip to content

Commit a294625

Browse files
committed
minor #9399 Documented the dynamic lock refresh (javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Documented the dynamic lock refresh This fixes #9379. Commits ------- 6597d4e Documented the dynamic lock refresh
2 parents 8f123c6 + 6597d4e commit a294625

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