CoreSystem.Memory
1.1.1
dotnet add package CoreSystem.Memory --version 1.1.1
NuGet\Install-Package CoreSystem.Memory -Version 1.1.1
<PackageReference Include="CoreSystem.Memory" Version="1.1.1" />
<PackageVersion Include="CoreSystem.Memory" Version="1.1.1" />
<PackageReference Include="CoreSystem.Memory" />
paket add CoreSystem.Memory --version 1.1.1
#r "nuget: CoreSystem.Memory, 1.1.1"
#:package CoreSystem.Memory@1.1.1
#addin nuget:?package=CoreSystem.Memory&version=1.1.1
#tool nuget:?package=CoreSystem.Memory&version=1.1.1
⚡ CoreSystem.Memory
Lightweight in-memory synchronization library for .NET 8, 9 and 10
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.
✨ Features
- ✅ Keyed asynchronous locking
- ✅ Thread-safe implementation
- ✅ Automatic lock lifecycle management
- ✅ Dependency Injection integration
- ✅ Targets .NET 8, .NET 9 and .NET 10
- ✅ Production-ready
📦 Installation
dotnet add package CoreSystem.Memory
🚀 Quick Start
Register the services:
builder.Services.AddCoreMemory();
Inject the lock provider:
public sealed class OrderService(IAsyncKeyLock lockProvider)
{
}
Acquire a keyed lock:
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.
⚙️ Configuration
Locks are created on demand with production-ready defaults; there is nothing to
configure. Inject IAsyncKeyLock and acquire by key.
⚠️ 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.
🏗 Architecture
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
│
▼
IAsyncKeyLock (MemoryLockProvider)
│
▼
ILockRegistry (MemoryLockRegistry)
│
▼
ConcurrentDictionary<string, MemoryLockEntry>
│
▼
SemaphoreSlim (one per key, reference-counted)
📚 Documentation
🤝 Contributing
Issues and pull requests are welcome.
📄 License
Released under the MIT License.
| 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 is compatible. 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 is compatible. 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. |
-
net10.0
-
net8.0
-
net9.0
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CoreSystem.Memory:
| Package | Downloads |
|---|---|
|
CoreSystem.Cache
Production-ready cache abstraction for .NET 8, .NET 9 and .NET 10 with In-Memory caching, extensible external storage, tag-based invalidation, HTTP response caching, and OpenTelemetry metrics. |
|
|
CoreSystem.Cache.Rehydration
Cache recovery component for CoreSystem.Cache on .NET 8, .NET 9 and .NET 10 that restores tracked memory fallback entries to the primary cache provider after recovery. |
|
|
CoreSystem.Cache.Redis
Redis external cache provider for CoreSystem.Cache on .NET 8, .NET 9 and .NET 10, with tag-based invalidation, distributed locking, health checks, and optional resilience integration. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial stable release.
- In-memory keyed asynchronous lock provider
- Thread-safe synchronization
- Automatic lock lifecycle management
- Dependency Injection integration
- Production-ready implementation
1.1.0: targets net8.0, net9.0 and net10.0. No public API or behavior change; the net9.0 and net10.0 assets are new, and the net8.0 asset is unchanged.
1.1.1: Dependency refresh on net10.0. Microsoft.Extensions.DependencyInjection.Abstractions 10.0.13 to 10.0.15. The target framework declarations (net8.0;net9.0;net10.0) moved to the central Directory.Packages.props. No code or API changes.