EnyimMemcachedCore 3.5.1 (original) (raw)
Enyim Memcached Client
This is a memcached client library for .NET migrated from EnyimMemcached.
Configure
The appsettings.json Without Authentication
{
"enyimMemcached": {
"Servers": [
{
"Address": "memcached",
"Port": 11211
}
],
"Transcoder": "MessagePackTranscoder"
}
}
The appsettings.json With Authentication
{
"enyimMemcached": {
"Servers": [
{
"Address": "memcached",
"Port": 11211
}
],
"Authentication": {
"Type": "Enyim.Caching.Memcached.PlainTextAuthenticator",
"Parameters": {
"zone": "",
"userName": "username",
"password": "password"
}
}
}
}
Startup.cs
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddEnyimMemcached();
// services.AddEnyimMemcached("enyimMemcached");
// services.AddEnyimMemcached(Configuration);
// services.AddEnyimMemcached(Configuration, "enyimMemcached");
// services.AddEnyimMemcached(Configuration.GetSection("enyimMemcached"));
// services.AddEnyimMemcached(options => options.AddServer("memcached", 11211));
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseEnyimMemcached();
}
}
Example usage
Use IMemcachedClient interface
public class HomeController : Controller
{
private readonly IMemcachedClient _memcachedClient;
private readonly IBlogPostService _blogPostService;
public HomeController(IMemcachedClient memcachedClient, IBlogPostService blogPostService)
{
_memcachedClient = memcachedClient;
_blogPostService = blogPostService;
}
public async Task<IActionResult> Index()
{
var cacheKey = "blogposts-recent";
var cacheSeconds = 600;
var posts = await _memcachedClient.GetValueOrCreateAsync(
cacheKey,
cacheSeconds,
async () => await _blogPostService.GetRecent(10));
return Ok(posts);
}
}
Use IDistributedCache interface
public class CreativeService
{
private ICreativeRepository _creativeRepository;
private IDistributedCache _cache;
public CreativeService(
ICreativeRepository creativeRepository,
IDistributedCache cache)
{
_creativeRepository = creativeRepository;
_cache = cache;
}
public async Task<IList<CreativeDTO>> GetCreatives(string unitName)
{
var cacheKey = $"creatives_{unitName}";
IList<CreativeDTO> creatives = null;
var creativesJson = await _cache.GetStringAsync(cacheKey);
if (creativesJson == null)
{
creatives = await _creativeRepository.GetCreatives(unitName)
.ProjectTo<CreativeDTO>().ToListAsync();
var json = string.Empty;
if (creatives != null && creatives.Count() > 0)
{
json = JsonConvert.SerializeObject(creatives);
}
await _cache.SetStringAsync(
cacheKey,
json,
new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(5)));
}
else
{
creatives = JsonConvert.DeserializeObject<List<CreativeDTO>>(creativesJson);
}
return creatives;
}
}
| Product | Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Framework | net48 is compatible. net481 is compatible. |
.NETFramework 4.8
- MessagePack (>= 3.1.4)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration (>= 10.0.3)
- Microsoft.Extensions.Logging (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Newtonsoft.Json.Bson (>= 1.0.3)
- System.Net.Security (>= 4.3.2)
.NETFramework 4.8.1
- MessagePack (>= 3.1.4)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration (>= 10.0.3)
- Microsoft.Extensions.Logging (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Newtonsoft.Json.Bson (>= 1.0.3)
- System.Net.Security (>= 4.3.2)
net10.0
- MessagePack (>= 3.1.4)
- Newtonsoft.Json.Bson (>= 1.0.3)
net6.0
- MessagePack (>= 3.1.4)
- Newtonsoft.Json.Bson (>= 1.0.3)
net7.0
- MessagePack (>= 3.1.4)
- Newtonsoft.Json.Bson (>= 1.0.3)
net8.0
- MessagePack (>= 3.1.4)
- Newtonsoft.Json.Bson (>= 1.0.3)
net9.0
- MessagePack (>= 3.1.4)
- Newtonsoft.Json.Bson (>= 1.0.3)
NuGet packages (51)
Showing the top 5 NuGet packages that depend on EnyimMemcachedCore:
| Package | Downloads |
|---|---|
| EasyCaching.Memcached A simple distributed caching provider based on EnyimMemcachedCore. | 768.7K |
| Senparc.CO2NET.Cache.Memcached WeChat Public Account - Memcached Module Senparc.CO2NET SDK Open Source Project: https://github.com/JeffreySu/WeiXinMPSDK | 218.9K |
| EDQ.WMS.Infrastructrue Package Description | 76.2K |
| GeneXus.Memcached.Core Package Description | 64.0K |
| Zicard.API.Common Bases microservices da Zicard API | 59.2K |
GitHub repositories (6)
Showing the top 6 popular GitHub repositories that depend on EnyimMemcachedCore:
| Repository | Stars |
|---|---|
| dotnetcore/EasyCaching 💥 EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier! | 2.1K |
| Cysharp/MasterMemory Source Generator based Embedded Typed Readonly In-Memory Document Database for .NET and Unity. | 1.8K |
| Senparc/Senparc.CO2NET Base Common Library, support for.NET Framework &.NET Core | 365 |
| grissomlau/jimu .netcore micro service framework | 358 |
| catcherwong/Demos 💯Some demos for learning | 269 |
| newrelic/newrelic-dotnet-agent The New Relic .NET language agent. | 114 |
Include prerelease
Include vulnerable
Include deprecated
| Version | Downloads | Last Updated |
|---|---|---|
| 3.5.1 | 10,850 | 5/15/2026 |
| 3.5.0 | 34,532 | 4/7/2026 |
| 3.4.7 | 8,616 | 3/19/2026 |
| 3.4.6 | 51,372 | 2/23/2026 |
| 3.4.5 | 264,523 | 9/9/2025 |
| 3.4.4 | 31,761 | 8/10/2025 |
| 3.4.3 | 2,057 | 8/10/2025 |
| 3.4.2 | 1,680 | 8/10/2025 |
| 3.4.1 | 11,112 | 8/4/2025 |
| 3.4.0 | 267,274 | 5/18/2025 |
| 3.3.3-pre2 | 2,113 | 1/24/2025 |
| 3.3.3-pre1 | 228 | 1/24/2025 |
| 3.3.2 | 390,601 | 12/19/2024 |
| 3.3.1 | 34,899 | 12/9/2024 |
| 3.3.0 | 196,387 | 11/23/2024 |
| 3.2.4 | 184,718 | 10/27/2024 |
| 3.2.3 | 508,048 | 9/2/2024 |
| 3.2.2 | 143,720 | 7/31/2024 |