Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d06fc6

Browse files
committed
Reduce usage of "you"
1 parentd6a218c commit8d06fc6

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

‎components/lock.rst‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,27 @@ that represents the locked resource::
5252
$lock->release();
5353
}
5454

55-
If the lock can not be acquired, the method returns ``false``.You can safely
56-
call the ``acquire()`` methodrepeatedly, even ifyoualready acquired it.
55+
If the lock can not be acquired, the method returns ``false``.The ``acquire()``
56+
method can be safely calledrepeatedly, even ifthe lock isalready acquired.
5757

5858
..note::
5959

6060
Unlike other implementations, the Lock Component distinguishes locks
61-
instances even when they are created for the same resource. Ifyou want to
62-
share a lock in several services, share the ``Lock`` instance returned by
63-
the ``Factory::createLock`` method.
61+
instances even when they are created for the same resource. Ifa lock has
62+
to be used by several services,they shouldshare thesame``Lock`` instance
63+
returned bythe ``Factory::createLock`` method.
6464

6565
Blocking Locks
6666
--------------
6767

6868
By default, when a lock cannot be acquired, the ``acquire`` method returns
69-
``false`` immediately.In case you want to wait (indefinitely) until the lock
70-
can be created, pass ``false`` as the argument of the ``acquire()`` method. This
69+
``false`` immediately.To wait (indefinitely) until the lock
70+
can be created, pass ``true`` as the argument of the ``acquire()`` method. This
7171
is called a **blocking lock** because the execution of your application stops
7272
until the lock is acquired.
7373

7474
Some of the built-in ``Store`` classes support this feature. When they don't,
75-
you candecorate them with the ``RetryTillSaveStore`` class::
75+
they canbe decorated with the ``RetryTillSaveStore`` class::
7676

7777
use Symfony\Component\Lock\Factory;
7878
use Symfony\Component\Lock\Store\RedisStore;
@@ -90,7 +90,7 @@ Expiring Locks
9090

9191
Locks created remotely are difficult to manage because there is no way for the
9292
remote ``Store`` to know if the locker process is still alive. Due to bugs,
93-
fatal errors or segmentation faults,we can't guarantee that the ``release()``
93+
fatal errors or segmentation faults,it cannot be guaranteed that ``release()``
9494
method will be called, which would cause the resource to be locked infinitely.
9595

9696
The best solution in those cases is to create **expiring locks**, which are
@@ -100,12 +100,12 @@ the ``createLock()`` method. If needed, these locks can also be released early
100100
with the ``release()`` method.
101101

102102
The trickiest part when working with expiring locks is choosing the right TTL.
103-
If it's too short, other processes could acquire the lock before finishingyour
104-
work; it it's too long and the process crashes before calling the ``release()``
103+
If it's too short, other processes could acquire the lock before finishingthe
104+
job; it it's too long and the process crashes before calling the ``release()``
105105
method, the resource will stay locked until the timeout::
106106

107107
// ...
108-
// createa expiring lock that lasts 30 seconds
108+
// createan expiring lock that lasts 30 seconds
109109
$lock = $factory->createLock('charts-generation', 30);
110110

111111
$lock->acquire();
@@ -173,16 +173,16 @@ PHP process is terminated::
173173
..caution::
174174

175175
Beware that some file systems (such as some types of NFS) do not support
176-
locking. In those cases, it's better to use alocal file or a remote store
177-
based on Redis or Memcached.
176+
locking. In those cases, it's better to use adirectory on a local disk
177+
drive or a remote storebased on Redis or Memcached.
178178

179179
.. _lock-store-memcached:
180180

181181
MemcachedStore
182182
~~~~~~~~~~~~~~
183183

184-
The MemcachedStore saves locks on a Memcached server,so first you must create
185-
a Memcachedconnectionimplements the ``\Memcached`` class. This store does not
184+
The MemcachedStore saves locks on a Memcached server,it requires a Memcached
185+
connectionimplementing the ``\Memcached`` class. This store does not
186186
support blocking, and expects a TTL to avoid stalled locks::
187187

188188
use Symfony\Component\Lock\Store\MemcachedStore;
@@ -201,8 +201,8 @@ support blocking, and expects a TTL to avoid stalled locks::
201201
RedisStore
202202
~~~~~~~~~~
203203

204-
The RedisStore saves locks on a Redis server,so first you must createa Redis
205-
connection implements the ``\Redis``, ``\RedisArray``, ``\RedisCluster`` or
204+
The RedisStore saves locks on a Redis server,it requiresa Redis connection
205+
implementing the ``\Redis``, ``\RedisArray``, ``\RedisCluster`` or
206206
``\Predis`` classes. This store does not support blocking, and expects a TTL to
207207
avoid stalled locks::
208208

@@ -233,7 +233,7 @@ The CombinedStore is designed for High Availability applications because it
233233
manages several stores in sync (for example, several Redis servers). When a lock
234234
is being acquired, it forwards the call to all the managed stores, and it
235235
collects their responses. If a simple majority of stores have acquired the lock,
236-
then the lock is considered as acquired; otherwiseis not acquired::
236+
then the lock is considered as acquired; otherwiseas not acquired::
237237

238238
use Symfony\Component\Lock\Quorum\ConsensusStrategy;
239239
use Symfony\Component\Lock\Store\CombinedStore;
@@ -249,8 +249,9 @@ then the lock is considered as acquired; otherwise is not acquired::
249249

250250
$store = new CombinedStore($stores, new ConsensusStrategy());
251251

252-
Instead of the simple majority strategy (``ConsensusStrategy``) you can use the
253-
``UnanimousStrategy`` to require the lock to be acquired in all the stores.
252+
Instead of the simple majority strategy (``ConsensusStrategy``) an
253+
``UnanimousStrategy`` can be used to require the lock to be acquired in all
254+
he stores.
254255

255256
.. _`locks`:https://en.wikipedia.org/wiki/Lock_(computer_science)
256257
.. _Packagist:https://packagist.org/packages/symfony/lock

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp