8000 [Lock] Make various changes/updates on the Lock docs by fabpot · Pull Request #17413 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Lock] Make various changes/updates on the Lock docs #17413

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

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Tweak wording
  • Loading branch information
fabpot committed Nov 7, 2022
commit ef38c4ef50f651e68519a1e0ea802a76b60084a7
11 changes: 6 additions & 5 deletions components/lock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ continue the job in another process using the same lock::

.. note::

Don't forget to disable the ``autoRelease`` flag in the ``Lock``
constructor to avoid releasing the lock when the destructor is called.
Don't forget to set the ``autoRelease`` argument to ``false`` in the
``Lock`` constructor to avoid releasing the lock when the destructor is
called.

Not all stores are compatible with serialization and cross-process locking: for
example, the kernel will automatically release semaphores acquired by the
Expand Down Expand Up @@ -208,7 +209,7 @@ processes. In the example below, ``pcntl_fork()`` creates two processes and the
Lock will be released automatically as soon as one process finishes::

// ...
$lock = $factory->createLock('pdf-creation', 3600);
$lock = $factory->createLock('pdf-creation');
if (!$lock->acquire()) {
return;
}
Expand All @@ -231,7 +232,7 @@ To disable this behavior, set the ``autoRelease`` argument of
``LockFactory::createLock()`` to ``false``. That will make the lock acquired
for 3600 seconds or until ``Lock::release()`` is called::

$lock = $factory->createLock('pdf-creation', 3600, autoRelease: false);
$lock = $factory->createLock('pdf-creation', ttl: 3600, autoRelease: false);

Shared Locks
------------
Expand Down Expand Up @@ -265,7 +266,7 @@ to acquire the lock in a blocking mode::
store (e.g. Redis store prioritizes readers vs writers).

When a read-only lock is acquired with the ``acquireRead()`` method, it's
possible to **promote** the lock, and change it to write lock, by calling the
possible to **promote** the lock, and change it to a write lock, by calling the
``acquire()`` method::

$lock = $factory->createLock('user-'.$userId);
Expand Down
0