Naravel.Cache.Memcached
0.2.0
dotnet add package Naravel.Cache.Memcached --version 0.2.0
NuGet\Install-Package Naravel.Cache.Memcached -Version 0.2.0
<PackageReference Include="Naravel.Cache.Memcached" Version="0.2.0" />
<PackageVersion Include="Naravel.Cache.Memcached" Version="0.2.0" />
<PackageReference Include="Naravel.Cache.Memcached" />
paket add Naravel.Cache.Memcached --version 0.2.0
#r "nuget: Naravel.Cache.Memcached, 0.2.0"
#:package Naravel.Cache.Memcached@0.2.0
#addin nuget:?package=Naravel.Cache.Memcached&version=0.2.0
#tool nuget:?package=Naravel.Cache.Memcached&version=0.2.0
Naravel.Cache.Memcached
Memcached cache and lock providers for Naravel.Cache.
| Fact | Detail |
|---|---|
| Install | dotnet add package Naravel.Cache.Memcached |
| Targets | .NET 10 |
| Needs | Naravel.Cache, which NuGet installs with it |
| Client | EnyimMemcachedCore, one shared client for every Memcached store |
What you get
- Memcached behind the same cache. Name
"Driver": "memcached"in a store, and the cache calls you already use read and write Memcached. - Locks across instances.
MemcachedLockacquires a lock atomically and releases it with the token it handed out. - Counters with a TTL.
IncrementAsyncandDecrementAsync, plus an overload that sets the expiry when it creates the counter. - One client for every store. All Memcached stores share one server pool, so they must list the same servers; registration throws otherwise, and changing the list needs a restart.
Quick start
builder.Services.AddNaravelCache(builder.Configuration).AddNaravelMemcachedCache(builder.Configuration);
{ "Cache": { "Default": "memcached", "Stores": { "memcached": { "Driver": "memcached", "Servers": { "primary": { "Address": "localhost", "Port": "11211" } } } } } }
Inject ICacheStore as usual; it now reads and writes Memcached. FlushAsync clears the whole Memcached cluster, not only this store's keys, so invalidate a subset with tags. Lock release has a small read/delete race: use Redis for critical sections.
Related packages
| Package | Adds |
|---|---|
Naravel.Cache |
Named stores, tags, scopes and locks that this provider backs |
Naravel.Cache.Redis |
The Redis provider: atomic lock release, and a flush that stays inside the store's prefix |
Learn more
- Cache: English guide
- Changelog · Source and issues · MIT license
Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- EnyimMemcachedCore (>= 3.5.2)
- MessagePack (>= 3.1.12)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Naravel.Cache (>= 0.2.0)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release notes: https://github.com/km-arc/Naravel/releases/tag/v0.2.0 - full history: https://github.com/km-arc/Naravel/blob/main/CHANGELOG.md