Back to Quartznet

Quartz.Extensions.Redis

src/Quartz.Extensions.Redis/README.md

3.19.01.5 KB
Original Source

Quartz.Extensions.Redis

Quartz.Extensions.Redis provides a Redis-based distributed lock handler that replaces database row locks in clustered Quartz.NET setups.

Note: Quartz 3.18 or later required. Useful when the default database row locks cause deadlocks or contention on the QRTZ_LOCKS table under heavy scheduling load.

Installation

shell
dotnet add package Quartz.Extensions.Redis

Usage

Job and trigger data stays in your relational database; only the locks move to Redis (SET NX PX):

csharp
var schedulerFactory = SchedulerBuilder.Create()
    .UsePersistentStore(store =>
    {
        store.UseSqlServer(connectionString);
        store.UseSystemTextJsonSerializer();
        store.UseClustering();
        store.UseRedisLockHandler(redis =>
        {
            redis.RedisConfiguration = "redis-server:6379";
        });
    })
    .Build();
PropertyDefaultDescription
redisConfigurationlocalhost:6379StackExchange.Redis connection string
keyPrefixquartz:lock:Prefix for Redis lock keys
lockTtlMilliseconds30000Lock TTL (auto-expires after this duration)
lockRetryIntervalMilliseconds100Polling interval between SET NX retries

Documentation

šŸ“– Full documentation, including property-based configuration and design details: https://www.quartz-scheduler.net/documentation/quartz-3.x/packages/redis.html