@@ -40,35 +40,6 @@ public function acquireTransactionLevelLock(
40
40
);
41
41
}
42
42
43
- /**
44
- * Acquire a session-level advisory lock with configurable wait and access modes.
45
- *
46
- * ⚠️ Transaction-level advisory locks are strongly preferred whenever possible,
47
- * as they are automatically released at the end of a transaction and are less error-prone.
48
- * Use session-level locks only when transactional context is not available.
49
- * @see acquireTransactionLevelLock() for preferred locking strategy.
50
- */
51
- public function acquireSessionLevelLock (
52
- PDO $ dbConnection ,
53
- PostgresLockKey $ key ,
54
- PostgresLockWaitModeEnum $ waitMode = PostgresLockWaitModeEnum::NonBlocking,
55
- PostgresLockAccessModeEnum $ accessMode = PostgresLockAccessModeEnum::Exclusive,
56
- ): SessionLevelLockHandle {
57
- return new SessionLevelLockHandle (
58
- $ dbConnection ,
59
- $ this ,
60
- $ key ,
61
- $ accessMode ,
62
- wasAcquired: $ this ->acquireLock (
63
- $ dbConnection ,
64
- $ key ,
65
- PostgresLockLevelEnum::Session,
66
- $ waitMode ,
67
- $ accessMode ,
68
- ),
69
- );
70
- }
71
-
72
43
/**
73
44
* Acquires a session-level advisory lock and ensures its release after executing the callback.
74
45
*
@@ -118,6 +89,35 @@ public function withinSessionLevelLock(
118
89
}
119
90
}
120
91
92
+ /**
93
+ * Acquire a session-level advisory lock with configurable wait and access modes.
94
+ *
95
+ * ⚠️ Transaction-level advisory locks are strongly preferred whenever possible,
96
+ * as they are automatically released at the end of a transaction and are less error-prone.
97
+ * Use session-level locks only when transactional context is not available.
98
+ * @see acquireTransactionLevelLock() for preferred locking strategy.
99
+ */
100
+ public function acquireSessionLevelLock (
101
+ PDO $ dbConnection ,
102
+ PostgresLockKey $ key ,
103
+ PostgresLockWaitModeEnum $ waitMode = PostgresLockWaitModeEnum::NonBlocking,
104
+ PostgresLockAccessModeEnum $ accessMode = PostgresLockAccessModeEnum::Exclusive,
105
+ ): SessionLevelLockHandle {
106
+ return new SessionLevelLockHandle (
107
+ $ dbConnection ,
108
+ $ this ,
109
+ $ key ,
110
+ $ accessMode ,
111
+ wasAcquired: $ this ->acquireLock (
112
+ $ dbConnection ,
113
+ $ key ,
114
+ PostgresLockLevelEnum::Session,
115
+ $ waitMode ,
116
+ $ accessMode ,
117
+ ),
118
+ );
119
+ }
120
+
121
121
/**
122
122
* Release session level advisory lock.
123
123
*/
0 commit comments