CoreSystem.Memory 1.0.0

dotnet add package CoreSystem.Memory --version 1.0.0
                    
NuGet\Install-Package CoreSystem.Memory -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="CoreSystem.Memory" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreSystem.Memory" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CoreSystem.Memory" />
                    
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 CoreSystem.Memory --version 1.0.0
                    
#r "nuget: CoreSystem.Memory, 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 CoreSystem.Memory@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=CoreSystem.Memory&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CoreSystem.Memory&version=1.0.0
                    
Install as a Cake Tool

⚡ CoreSystem.Memory

Lightweight in-memory synchronization library for .NET 8

CoreSystem.Memory provides keyed asynchronous locks for coordinating concurrent operations within a single process. It is lightweight, thread-safe, dependency injection friendly, and designed for production workloads.

NuGet Downloads License .NET


✨ Features

  • ✅ Keyed asynchronous locking
  • ✅ Thread-safe implementation
  • ✅ Automatic lock lifecycle management
  • ✅ Lightweight and allocation-friendly
  • ✅ Dependency Injection integration
  • ✅ Designed for .NET 8
  • ✅ Production-ready

📦 Installation

dotnet add package CoreSystem.Memory

🚀 Quick Start

Register the services:

builder.Services.AddCoreMemory();

Inject the lock provider:

public sealed class OrderService(IMemoryLockProvider lockProvider)
{
}

Acquire a keyed lock:

await using (await lockProvider.AcquireAsync($"orders:{orderId}"))
{
    // Critical section
}

🏗 Typical Use Cases

  • Prevent concurrent processing of the same entity.
  • Protect critical sections inside ASP.NET Core applications.
  • Synchronize background jobs.
  • Avoid duplicate in-process operations.
  • Coordinate access to shared resources.

📚 Design

Each key has its own asynchronous lock backed by SemaphoreSlim. Locks are created on demand and automatically removed when no longer in use, preventing unnecessary memory growth.

Application
      │
      ▼
IMemoryLockProvider
      │
      ▼
ConcurrentDictionary
      │
      ▼
SemaphoreSlim

⚠️ Important

CoreSystem.Memory synchronizes execution only inside the current process.

For synchronization across multiple application instances or servers, use a distributed locking solution such as Redis.


🤝 Contributing

Issues and pull requests are welcome.


📄 License

Released under the MIT License.

Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CoreSystem.Memory:

Package Downloads
CoreSystem.Cache

Distributed cache abstraction for .NET 8 supporting Redis and In-Memory providers, with native OpenTelemetry integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 131 7/8/2026

Initial stable release.
• In-memory keyed asynchronous lock provider
• Thread-safe synchronization
• Automatic lock lifecycle management
• Dependency Injection integration
• Production-ready implementation