From 6597d4e58e8c148f719d0887cc55b49f3071d707 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 6 Mar 2018 17:07:31 +0100 Subject: [PATCH] Documented the dynamic lock refresh --- components/lock.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/lock.rst b/components/lock.rst index a92da0dbe20..ddb53a14b38 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -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 ----------------