- What is ginnerpeace/laravel-redis-lock used for in Laravel?
- It is a Laravel package that adds Redis-backed distributed locks so multiple processes or servers can coordinate concurrent work. It is aimed at preventing race conditions in queued jobs, Artisan commands, and scheduled tasks by letting you acquire, release, and manage locks with TTLs and blocking waits. It layers on Redis you already run rather than introducing new infrastructure.
- How do I install ginnerpeace/laravel-redis-lock?
- Install it with Composer using composer require ginnerpeace/laravel-redis-lock. It fits Laravel's standard package architecture with a service provider and auto-discovery, so integration is mechanically simple. You may also need to publish a config file, but confirm the exact steps in the README.
- Do I need to configure laravel-redis-lock after installation?
- The package may expose a publishable config file, but the provided excerpt does not document specific configuration keys. It uses your existing Redis infrastructure, so the main setup questions are which Redis connection to use and what TTL or blocking behavior you need. Check the README and config source before relying on defaults.
- Which Laravel and PHP versions does laravel-redis-lock support?
- The provided context does not give a confirmed version matrix, and this must be verified before adoption. The technical assessment specifically flags Laravel 10/11/12, PHP 8.1+, phpredis versus predis, Redis 6/7, and cluster or Sentinel behavior as compatibility questions. Inspect the package's composer.json constraints to avoid a blocker at your next framework upgrade.
- How does laravel-redis-lock compare with Laravel's built-in Cache::lock()?
- Laravel already ships a distributed lock implementation through Illuminate\Cache\Lock and Cache::lock(), including owner tokens, TTL, blocking acquisition, and restoreLock(). The assessment treats native locking as the baseline and says this package is only justified if it adds Redlock quorum, watchdog auto-renew, lockable traits, or declarative retry policies. The README's simple framing suggests a thin ergonomic wrapper, so use Cache::lock() first unless you confirm a real capability gap.
- Does laravel-redis-lock implement Redlock quorum across multiple Redis nodes?
- That is not confirmed by the provided context, and the README's simple framing points more toward a thin wrapper than net-new multi-node capability. A Redlock quorum implementation would be a meaningful differentiator, but it also inherits the known safety debate around clock skew and partitions. Read the source and tests before assuming quorum behavior.
- Is lock release in laravel-redis-lock atomic and owner-token verified?
- The provided context does not confirm whether release uses an atomic Lua compare-and-delete or a naive DEL. Owner-token verification matters because a non-atomic release can let one process delete another process's lock. This is a precondition-level audit item for any concurrency-critical dependency.
- Does laravel-redis-lock auto-renew locks or protect long-running jobs?
- There is no confirmed watchdog or auto-renew behavior in the provided context. If every lock hard-expires at its TTL, a job that runs longer than the TTL can overlap with another worker while the application believes it is serialized. Fencing tokens and stale-lock protection also need to be verified, not assumed.
- Is laravel-redis-lock safe with Laravel Octane and Redis Cluster or Sentinel?
- This must be confirmed rather than assumed. For Octane, the package needs to be stateless across requests with no static or request-scoped state leaking between workers. For Redis Cluster or Sentinel, verify key-slot safety, including hash tags for multi-key operations, and how failover affects lock ownership.
- Is laravel-redis-lock production-ready and well maintained, and what should I use instead?
- The assessment flags supply-chain and maintenance risk: roughly 15 stars and a single maintainer mean little external review, no clear security disclosure process, and a high probability of abandonment. Test coverage and CI against real Redis are not confirmed in the provided context and should be checked. The default recommendation is to inventory ad-hoc locking, migrate those call sites to native Cache::lock() first, and treat this package as an exception requiring justification.