aboutcoders/resource-lock-bundle
Symfony bundle providing a resource locking system backed by ORM. Configure a default lock manager and optional custom managers with prefixes, then fetch lock manager services from the container to set, get, and check locks across your app.
my_prefix:user_123), enabling fine-grained locking (e.g., per-user, per-resource).SELECT ... FOR UPDATE (PostgreSQL) or optimistic locking (MySQL), which may require database-specific tuning (e.g., innodb_lock_wait_timeout).SELECT ... FOR UPDATE or equivalent?SET LOCK_TIMEOUT in SQL Server)?user_123 vs. user_123_cart)?pg_stat_activity for PostgreSQL)?predis) or Laravel’s built-in mutex be considered for lower latency?AppKernel with a Laravel Service Provider (ResourceLockServiceProvider).app('abc.resource_lock.lock_manager')) instead of Symfony’s DI.SELECT ... FOR UPDATE SKIP LOCKED (optimistic locking).GET_LOCK() (user-level locks) or SELECT ... FOR UPDATE..env (e.g., RESOURCE_LOCK_DRIVER=orm) and config files (config/resource-lock.php).LockManager) with:
acquire($name, $ttl = 30) → Returns true/false.release($name) → Explicit unlock.UPDATE locks SET expires_at = NOW() + INTERVAL '30 seconds' WHERE name = ?).doctrine/dbal via Composer).APPLOCK or sp_getapplock.Symfony\Component\DependencyInjection by using Laravel’s bindings.LockManager with acquire()/release().inventory_locks).call_user_func_array changes).locks table size).pg_stat_activity).innodb_lock_wait_timeout).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database downtime | Locks lost; app hangs | Use Redis fallback or local mutex |
| Long-running locks | Deadlocks, timeouts | TTL + watchdog |
| Network partitions | Split-brain locks | Lease-based locks (short TTL) |
| Lock table corruption | False positives/negatives | Database backups + repairs |
| High contention | Slow responses | Queue-based retries |
How can I help you explore Laravel packages today?