@@ -153,17 +153,23 @@ object) and ``isExpired()`` (which returns a boolean).
153
153
The Owner of The Lock
154
154
---------------------
155
155
156
- Locks that are acquired for the first time are owned by the process that acquired
157
- it. If you need to check whether the current process is (still) the owner of
158
- a process , you can use the ``isAcquired() `` method::
156
+ Locks that are acquired for the first time are owned by the `` Lock `` instance[1]_ that acquired
157
+ it. If you need to check whether the current `` Lock `` instance is (still) the owner of
158
+ a lock , you can use the ``isAcquired() `` method::
159
159
160
160
if ($lock->isAcquired()) {
161
- // This process (still) owns the lock
161
+ // We (still) own the lock
162
162
}
163
163
164
+ .. note ::
165
+
166
+ [1] Technically, the true owners of the lock are the ones that share the same instance of ``Key ``,
167
+ not ``Lock ``. But from a user perspective, ``Key `` is internal and you will likely only be working
168
+ with the ``Lock `` instance so it's easier to think of the ``Lock `` instance as being the one that
169
+ is the owner of the lock.
164
170
165
171
Because of the fact that some lock stores have expiring locks (as seen and explained
166
- above), it is possible for a process to lose the lock it acquired automatically::
172
+ above), it is possible for an instance to lose the lock it acquired automatically::
167
173
168
174
// If we cannot acquire ourselves, it means some other process is already working on it
169
175
if (!$lock->acquire()) {
@@ -175,7 +181,7 @@ above), it is possible for a process to lose the lock it acquired automatically:
175
181
// Perform a very long process that might exceed TTL of the lock
176
182
177
183
if ($lock->isAcquired()) {
178
- // Still all good, no other process has acquired the lock in the meantime, we're safe
184
+ // Still all good, no other instance has acquired the lock in the meantime, we're safe
179
185
$this->commit();
180
186
} else {
181
187
// Bummer! Our lock has apparently exceeded TTL and another process has started in
0 commit comments