Skip to content

Documented the dynamic lock refresh #9399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2018
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