EnyimMemcachedCore 3.4.5
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;
}
}
Showing the top 20 packages that depend on EnyimMemcachedCore.
| Packages | Downloads |
|---|---|
|
EasyCaching.Memcached
EasyCaching.Memcached based on EasyCaching.Core and EnyimMemcachedCore
|
2 |
|
EasyCaching.Memcached
A simple distributed caching provider based on EnyimMemcachedCore.
|
2 |
.NET Framework 4.8
- MessagePack (>= 2.5.192)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Newtonsoft.Json.Bson (>= 1.0.3)
- System.Net.Security (>= 4.3.2)
.NET Framework 4.8.1
- MessagePack (>= 2.5.192)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Newtonsoft.Json.Bson (>= 1.0.3)
- System.Net.Security (>= 4.3.2)
.NET 6.0
- MessagePack (>= 2.5.192)
- Newtonsoft.Json.Bson (>= 1.0.3)
.NET 7.0
- MessagePack (>= 2.5.192)
- Newtonsoft.Json.Bson (>= 1.0.3)
.NET 8.0
- MessagePack (>= 2.5.192)
- Newtonsoft.Json.Bson (>= 1.0.3)
.NET 9.0
- MessagePack (>= 2.5.192)
- Newtonsoft.Json.Bson (>= 1.0.3)
| Version | Downloads | Last updated |
|---|---|---|
| 3.4.5 | 1 | 2025/11/19 |
| 3.4.4 | 2 | 2025/8/25 |
| 3.4.3 | 2 | 2025/8/25 |
| 3.4.2 | 2 | 2025/8/25 |
| 3.4.1 | 2 | 2025/8/25 |
| 3.4.0 | 2 | 2025/8/25 |
| 3.3.3-pre2 | 1 | 2025/8/28 |
| 3.3.3-pre1 | 1 | 2025/8/28 |
| 3.3.2 | 2 | 2025/8/25 |
| 3.3.1 | 2 | 2025/8/25 |
| 3.3.0 | 2 | 2025/8/25 |
| 3.2.4 | 2 | 2025/8/25 |
| 3.2.3 | 2 | 2025/8/25 |
| 3.2.2 | 2 | 2025/8/25 |
| 3.2.1 | 2 | 2025/8/25 |
| 3.2.0 | 2 | 2025/8/25 |
| 3.1.0 | 2 | 2025/8/25 |
| 3.0.1 | 2 | 2025/8/25 |
| 3.0.0 | 2 | 2025/8/25 |
| 2.7.1 | 2 | 2025/8/25 |
| 2.7.0 | 2 | 2025/8/25 |
| 2.6.6 | 2 | 2025/8/25 |
| 2.6.5 | 2 | 2025/8/21 |
| 2.6.4 | 2 | 2025/8/25 |
| 2.6.3 | 2 | 2025/8/25 |
| 2.6.2 | 2 | 2025/8/25 |
| 2.6.1 | 2 | 2025/8/25 |
| 2.6.0 | 1 | 2025/8/25 |
| 2.5.7 | 2 | 2025/8/25 |
| 2.5.6 | 2 | 2025/8/25 |
| 2.5.5 | 2 | 2025/8/25 |
| 2.5.4 | 2 | 2025/8/25 |
| 2.5.3 | 2 | 2025/8/25 |
| 2.5.2 | 2 | 2025/8/25 |
| 2.5.2-preview1 | 1 | 2025/8/29 |
| 2.5.1 | 2 | 2025/8/25 |
| 2.5.0 | 2 | 2025/8/25 |
| 2.5.0-preview3 | 1 | 2025/8/29 |
| 2.5.0-preview2 | 1 | 2025/8/29 |
| 2.5.0-preview1 | 1 | 2025/8/29 |
| 2.4.5 | 2 | 2025/8/25 |
| 2.4.4 | 2 | 2025/8/25 |
| 2.4.3 | 2 | 2025/8/25 |
| 2.4.2 | 2 | 2025/8/25 |
| 2.4.1 | 2 | 2025/8/25 |
| 2.4.0 | 2 | 2025/8/25 |
| 2.3.0 | 2 | 2025/8/25 |
| 2.2.4 | 2 | 2025/8/25 |
| 2.2.3 | 2 | 2025/8/25 |
| 2.2.2 | 2 | 2025/8/25 |
| 2.2.0 | 2 | 2025/8/25 |
| 2.1.14 | 2 | 2025/8/28 |
| 2.1.13 | 2 | 2025/8/28 |
| 2.1.12 | 2 | 2025/8/28 |
| 2.1.11 | 2 | 2025/8/28 |
| 2.1.10 | 2 | 2025/8/28 |
| 2.1.9 | 2 | 2025/8/25 |
| 2.1.8 | 2 | 2025/8/25 |
| 2.1.7 | 2 | 2025/8/25 |
| 2.1.5 | 2 | 2025/8/25 |
| 2.1.3 | 2 | 2025/8/25 |
| 2.1.2 | 2 | 2025/8/25 |
| 2.1.1 | 2 | 2025/8/25 |
| 2.1.0.7 | 1 | 2025/8/28 |
| 2.1.0.6 | 1 | 2025/8/28 |
| 2.1.0.5 | 2 | 2025/8/28 |
| 2.1.0.4 | 1 | 2025/8/28 |
| 2.1.0.3 | 2 | 2025/8/28 |
| 2.1.0.2 | 1 | 2025/8/28 |
| 2.1.0.1 | 1 | 2025/11/12 |
| 2.1.0 | 2 | 2025/8/25 |
| 2.0.4 | 2 | 2025/8/25 |
| 2.0.2 | 2 | 2025/8/25 |
| 2.0.1 | 2 | 2025/8/25 |
| 2.0.0 | 2 | 2025/8/25 |
| 2.0.0-beta1 | 1 | 2025/8/28 |
| 1.1.1.12 | 1 | 2025/8/28 |
| 1.1.1.11 | 0 | 2017/7/8 |
| 1.1.1.10 | 1 | 2025/8/28 |
| 1.1.1.9 | 1 | 2025/8/28 |
| 1.1.1.8 | 2 | 2025/8/28 |
| 1.1.1.7 | 2 | 2025/8/28 |
| 1.1.1.6 | 2 | 2025/8/28 |
| 1.1.1.5 | 2 | 2025/8/28 |
| 1.1.1.4 | 2 | 2025/8/28 |
| 1.1.1.3 | 2 | 2025/8/28 |
| 1.1.1.2 | 2 | 2025/8/28 |
| 1.1.1.1 | 0 | 2016/12/20 |
| 1.1.1 | 2 | 2025/8/25 |
| 1.1.0.2 | 1 | 2025/8/28 |
| 1.1.0.1 | 1 | 2025/8/28 |
| 1.1.0 | 1 | 2025/8/25 |
| 1.0.0.8 | 1 | 2025/8/28 |
| 1.0.0.7-preview1 | 1 | 2025/8/28 |
| 1.0.0.6 | 1 | 2025/8/28 |
| 1.0.0.5 | 2 | 2025/8/28 |
| 1.0.0.4 | 1 | 2025/8/28 |
| 1.0.0.3 | 1 | 2025/8/28 |
| 1.0.0.2 | 1 | 2025/8/28 |
| 1.0.0.1 | 1 | 2025/8/28 |
| 1.0.0 | 2 | 2025/8/25 |