Genetom.ULID
0.1.0
dotnet add package Genetom.ULID --version 0.1.0
NuGet\Install-Package Genetom.ULID -Version 0.1.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="Genetom.ULID" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Genetom.ULID" Version="0.1.0" />
<PackageReference Include="Genetom.ULID" />
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 Genetom.ULID --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Genetom.ULID, 0.1.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 Genetom.ULID@0.1.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=Genetom.ULID&version=0.1.0
#tool nuget:?package=Genetom.ULID&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
GenetomULID
GenetomULID is a high-performance 64-bit ULID generator for distributed systems.
It uses a compact bit layout:
- 41 bits → Timestamp (milliseconds since custom epoch)
- 10 bits → Server/Machine ID
- 12 bits → Sequence per millisecond
This allows up to 4096 IDs per server per millisecond and supports 1024 unique servers in a cluster.
📦 Installation
dotnet add package Genetom.ULID
🚀 Usage
using Genetom.ULID;
// One time initialization in program.cs
GenetomULID.SetServerId(12); // Optional , Default serverId is 0
long id = GenetomULID.GenerateId64();
Console.WriteLine(id);
⚙️ Bit Layout
Bits | Field | Description |
---|---|---|
41 | Timestamp | Milliseconds since custom epoch |
10 | Server ID | Unique per server (0–1023) |
12 | Sequence | Counter per millisecond (0–4095) |
📊 Benchmark (BenchmarkDotNet)
Method | Mean | Error | StdDev | Gen0 | Allocated |
---|---|---|---|---|---|
GenetomULID_GenerateId64 |
33.21 ns | 0.571 ns | 0.506 ns | 0.0038 | 32 B |
GenerateGUID |
39.02 ns | 0.798 ns | 0.980 ns | - | - |
📝 License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.