Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/lock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ to reset the TTL to its original value::
$lock->release();
}

.. tip::

Another useful technique for long-running tasks is to pass a custom TTL as
an argument of the ``refresh()`` method to change the default lock TTL::

$lock = $factory->createLock('charts-generation', 30);
// ...
// refresh the lock for 30 seconds
$lock->refresh();
// ...
// refresh the lock for 600 seconds (next refresh() call will be 30 seconds again)
$lock->refresh(600);

.. versionadded:: 4.1
The feature to pass a custom TTL as an argument of the ``refresh()``
method was introduced in Symfony 4.1.

Available Stores
----------------

Expand Down