Sloop 1.0.0
See the version list below for details.
dotnet add package Sloop --version 1.0.0
NuGet\Install-Package Sloop -Version 1.0.0
<PackageReference Include="Sloop" Version="1.0.0" />
<PackageVersion Include="Sloop" Version="1.0.0" />
<PackageReference Include="Sloop" />
paket add Sloop --version 1.0.0
#r "nuget: Sloop, 1.0.0"
#:package Sloop@1.0.0
#addin nuget:?package=Sloop&version=1.0.0
#tool nuget:?package=Sloop&version=1.0.0
โ Sloop
Sloop is a lightweight, PostgreSQL-backed implementation of IDistributedCache for .NET applications. It provides durable, high-performance caching with support for sliding and absolute expiration. Designed for simplicity and resilience in distributed systems.
โจ Features
- โก Distributed key-value store backed by PostgreSQL
- ๐ Support for sliding and absolute expiration
- ๐ Safe for multi-instance use
- ๐งน Periodic cleanup of expired entries
- ๐งช Fully integration-tested with high coverage
- ๐ฆ Compatible with
Microsoft.Extensions.Caching.Abstractions - ๐ Powered by Npgsql and Dapper
- ๐ Simple, idiomatic DI registration
๐ฆ Installation
dotnet add package Sloop
Requires .NET 8.0 SDK or later
๐ Quick Start
Register with Dependency Injection
builder.Services.AddCache(options =>
{
options.ConnectionString = builder.Configuration.GetConnectionString("Postgres")!;
options.SchemaName = "public";
options.TableName = "cache";
options.DefaultExpiration = TimeSpan.FromMinutes(30); // optional
});
Use the IDistributedCache
public class MyService
{
private readonly IDistributedCache _cache;
public MyService(IDistributedCache cache)
{
_cache = cache;
}
public async Task UseCacheAsync()
{
var key = "user:123";
var data = await _cache.GetStringAsync(key);
if (data == null)
{
data = "example";
await _cache.SetStringAsync(key, data, new DistributedCacheEntryOptions
{
SlidingExpiration = TimeSpan.FromMinutes(10),
AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1)
});
}
}
}
๐งช Testing
Tests are executed against disposable PostgreSQL containers via Testcontainers:
dotnet test
๐ค Contributing
Contributions are welcome! Please follow standard C# coding guidelines and include tests with pull requests.
๐ License
Licensed 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 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. |
-
net8.0
- Dapper (>= 2.1.66)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Options (>= 9.0.5)
- Npgsql (>= 9.0.3)
-
net9.0
- Dapper (>= 2.1.66)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Options (>= 9.0.5)
- Npgsql (>= 9.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.