EnyimMemcachedCore 2.7.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EnyimMemcachedCore --version 2.7.1
NuGet\Install-Package EnyimMemcachedCore -Version 2.7.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EnyimMemcachedCore" Version="2.7.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EnyimMemcachedCore --version 2.7.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EnyimMemcachedCore, 2.7.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EnyimMemcachedCore as a Cake Addin #addin nuget:?package=EnyimMemcachedCore&version=2.7.1 // Install EnyimMemcachedCore as a Cake Tool #tool nuget:?package=EnyimMemcachedCore&version=2.7.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- MessagePack (>= 2.5.140)
- Newtonsoft.Json.Bson (>= 1.0.2)
-
net7.0
- MessagePack (>= 2.5.140)
- Newtonsoft.Json.Bson (>= 1.0.2)
-
net8.0
- MessagePack (>= 2.5.140)
- Newtonsoft.Json.Bson (>= 1.0.2)
NuGet packages (45)
Showing the top 5 NuGet packages that depend on EnyimMemcachedCore:
Package | Downloads |
---|---|
EasyCaching.Memcached
A simple distributed caching provider based on EnyimMemcachedCore. |
|
Senparc.CO2NET.Cache.Memcached
微信公众账号 - Memcached 模块 Senparc.CO2NET SDK 开源项目: https://github.com/JeffreySu/WeiXinMPSDK |
|
EDQ.WMS.Infrastructrue
Package Description |
|
Zicard.API.Common
Bases microservices da Zicard API |
|
MT.DotNetCore
MT DotNetCore Common Libs. |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on EnyimMemcachedCore:
Repository | Stars |
---|---|
dotnetcore/EasyCaching
:boom: 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!
|
|
Cysharp/MasterMemory
Embedded Typed Readonly In-Memory Document Database for .NET and Unity.
|
|
Senparc/Senparc.CO2NET
支持 .NET Framework & .NET Core 的公共基础扩展库
|
|
grissomlau/jimu
.netcore micro service framework
|
|
catcherwong/Demos
:100:Some demos for learning
|
Version | Downloads | Last updated |
---|---|---|
3.2.3 | 9,137 | 9/2/2024 |
3.2.2 | 35,048 | 7/31/2024 |
3.2.1 | 208,720 | 4/3/2024 |
3.2.0 | 88,639 | 2/22/2024 |
3.1.0 | 556 | 2/21/2024 |
3.0.1 | 35,482 | 2/6/2024 |
3.0.0 | 14,857 | 1/31/2024 |
2.7.1 | 26,157 | 2/6/2024 |
2.7.0 | 142,442 | 12/2/2023 |
2.6.6 | 444,000 | 5/2/2023 |
2.6.5 | 3,430 | 4/28/2023 |
2.6.4 | 227,416 | 1/29/2023 |
2.6.3 | 1,399 | 1/29/2023 |
2.6.2 | 1,047 | 1/29/2023 |
2.6.1 | 1,128 | 1/29/2023 |
2.6.0 | 64,527 | 1/18/2023 |
2.5.7 | 78,803 | 1/1/2023 |
2.5.6 | 274,036 | 11/24/2022 |
2.5.5 | 44,420 | 11/4/2022 |
2.5.4 | 354,231 | 7/3/2022 |
2.5.3 | 1,249,573 | 1/27/2021 |
2.5.2 | 78,201 | 1/3/2021 |
2.5.2-preview1 | 1,453 | 12/4/2020 |
2.5.1 | 44,748 | 12/2/2020 |
2.5.0 | 2,114 | 12/2/2020 |
2.5.0-preview3 | 1,174 | 11/30/2020 |
2.5.0-preview2 | 1,137 | 11/30/2020 |
2.5.0-preview1 | 1,130 | 11/14/2020 |
2.4.5 | 259,215 | 11/17/2020 |
2.4.4 | 322,540 | 8/25/2020 |
2.4.3 | 247,089 | 3/25/2020 |
2.4.2 | 58,740 | 2/25/2020 |
2.4.1 | 207,162 | 10/16/2019 |
2.4.0 | 171,839 | 9/15/2019 |
2.3.0 | 80,637 | 7/10/2019 |
2.2.4 | 85,774 | 6/15/2019 |
2.2.3 | 13,176 | 5/25/2019 |
2.2.2 | 9,950 | 5/17/2019 |
2.2.0 | 62,820 | 5/16/2019 |
2.1.14 | 16,886 | 5/3/2019 |
2.1.13 | 10,636 | 4/21/2019 |
2.1.12 | 43,045 | 12/31/2018 |
2.1.11 | 1,978 | 12/30/2018 |
2.1.10 | 226,703 | 9/22/2018 |
2.1.9 | 24,636 | 9/16/2018 |
2.1.8 | 70,851 | 6/18/2018 |
2.1.7 | 3,736 | 6/12/2018 |
2.1.5 | 99,691 | 5/30/2018 |
2.1.3 | 2,203 | 5/29/2018 |
2.1.2 | 4,289 | 5/24/2018 |
2.1.1 | 12,171 | 5/23/2018 |
2.1.0.7 | 44,150 | 4/2/2018 |
2.1.0.6 | 2,533 | 3/26/2018 |
2.1.0.5 | 5,137 | 3/8/2018 |
2.1.0.4 | 2,463 | 3/5/2018 |
2.1.0.3 | 2,151 | 3/5/2018 |
2.1.0.2 | 29,221 | 1/19/2018 |
2.1.0.1 | 9,674 | 1/3/2018 |
2.1.0 | 136,827 | 12/15/2017 |
2.0.4 | 2,087 | 12/12/2017 |
2.0.2 | 25,198 | 9/7/2017 |
2.0.1 | 28,672 | 8/19/2017 |
2.0.0 | 6,307 | 8/15/2017 |
2.0.0-beta1 | 2,828 | 7/12/2017 |
1.1.1.12 | 12,093 | 7/8/2017 |
1.1.1.11 | 2,055 | 7/8/2017 |
1.1.1.10 | 8,192 | 5/20/2017 |
1.1.1.9 | 2,117 | 5/20/2017 |
1.1.1.8 | 3,838 | 4/20/2017 |
1.1.1.7 | 6,828 | 3/18/2017 |
1.1.1.6 | 10,420 | 3/16/2017 |
1.1.1.5 | 2,667 | 3/7/2017 |
1.1.1.4 | 2,336 | 3/7/2017 |
1.1.1.3 | 13,826 | 1/2/2017 |
1.1.1.2 | 2,313 | 12/24/2016 |
1.1.1.1 | 2,964 | 12/20/2016 |
1.1.1 | 2,592 | 12/10/2016 |
1.1.0.2 | 2,621 | 12/10/2016 |
1.1.0.1 | 2,432 | 12/8/2016 |
1.1.0 | 2,420 | 12/5/2016 |
1.0.0.8 | 6,840 | 11/11/2016 |
1.0.0.7-preview1 | 2,131 | 10/26/2016 |
1.0.0.6 | 5,790 | 10/20/2016 |
1.0.0.5 | 2,209 | 10/19/2016 |
1.0.0.4 | 2,221 | 10/18/2016 |
1.0.0.3 | 2,237 | 10/13/2016 |
1.0.0.2 | 2,267 | 9/27/2016 |
1.0.0.1 | 2,312 | 9/26/2016 |
1.0.0 | 3,373 | 3/25/2016 |