MeVitae.RedisWorkQueue 1.0.0

dotnet add package MeVitae.RedisWorkQueue --version 1.0.0
                    
NuGet\Install-Package MeVitae.RedisWorkQueue -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeVitae.RedisWorkQueue" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeVitae.RedisWorkQueue" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MeVitae.RedisWorkQueue" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeVitae.RedisWorkQueue --version 1.0.0
                    
#r "nuget: MeVitae.RedisWorkQueue, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MeVitae.RedisWorkQueue@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MeVitae.RedisWorkQueue&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MeVitae.RedisWorkQueue&version=1.0.0
                    
Install as a Cake Tool

RedisWorkQueue: Dotnet Implementation

A work queue, on top of a redis database, with implementations in Python, Rust, Go, Node.js (TypeScript) and Dotnet (C#).

This is the Dotnet implementations. For an overview of how the work queue works, it's limitations, and the general concepts and implementations in other languages, please read the redis-work-queue readme.

Documentation

Below is a brief example. More details on the core concepts can be found in the readme, and full API documentation can be found in ../RedisWorkQueue.pdf.

Example Usage

using FreeRedis;
using RedisWorkQueue;

var redis = new RedisClient("localhost");
var workQueue = new WorkQueue("work_queue");

var item = new Item(Encoding.UTF8.GetBytes("data"), "item_1");

workQueue.AddItem(redis, item);

var queueLength = workQueue.QueueLength(redis);
Console.WriteLine($"Queue Length: {queueLength}");

var lease = workQueue.Lease(redis, 30, true, 10);
if (lease != null)
{
    Console.WriteLine($"Leased Item: {lease.ID}");
    // Do the work here
    workQueue.Complete(redis, lease);
}
else
{
    Console.WriteLine("No item available to lease");
}

In this example, we create a Redis client and a new instance of the WorkQueue class. We then add an item to the work queue using the AddItem method and get the length of the main queue using the QueueLength method.

We then try to lease an item from the work queue using the Lease method. If an item is available, we do the work and mark the item as completed using the Complete method.

Note that in this example, we pass true for the block parameter of the Lease method, which means the method will block and wait for an item to be available if the main queue is empty. We also pass a timeout value of 10 seconds, which means that if there are no items available after 10 seconds, the method will return null.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 1,967 8/15/2025
0.3.0 7,656 9/16/2024
0.2.1 1,881 11/15/2023
0.1.6 636 8/17/2023
0.1.5 277 7/25/2023