EnyimMemcachedCore 3.4.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package EnyimMemcachedCore --version 3.4.3
                    
NuGet\Install-Package EnyimMemcachedCore -Version 3.4.3
                    
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="3.4.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EnyimMemcachedCore" Version="3.4.3" />
                    
Directory.Packages.props
<PackageReference Include="EnyimMemcachedCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EnyimMemcachedCore --version 3.4.3
                    
#r "nuget: EnyimMemcachedCore, 3.4.3"
                    
#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.
#:package EnyimMemcachedCore@3.4.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EnyimMemcachedCore&version=3.4.3
                    
Install as a Cake Addin
#tool nuget:?package=EnyimMemcachedCore&version=3.4.3
                    
Install as a Cake Tool

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 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. 
.NET Framework net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (47)

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

WeChat Public Account - Memcached Module Senparc.CO2NET SDK Open Source Project: 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 (6)

Showing the top 6 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
Source Generator based Embedded Typed Readonly In-Memory Document Database for .NET and Unity.
Senparc/Senparc.CO2NET
Base Common Library, support for.NET Framework &.NET Core
grissomlau/jimu
.netcore micro service framework
catcherwong/Demos
:100:Some demos for learning
newrelic/newrelic-dotnet-agent
The New Relic .NET language agent.
Version Downloads Last Updated
3.4.4 2,656 8/10/2025
3.4.3 135 8/10/2025
3.4.2 103 8/10/2025
3.4.1 1,666 8/4/2025
3.4.0 85,743 5/18/2025
3.3.3-pre2 1,630 1/24/2025
3.3.3-pre1 115 1/24/2025
3.3.2 172,667 12/19/2024
3.3.1 20,899 12/9/2024
3.3.0 81,795 11/23/2024
3.2.4 131,484 10/27/2024
3.2.3 235,019 9/2/2024
3.2.2 102,240 7/31/2024
3.2.1 535,759 4/3/2024
3.2.0 154,990 2/22/2024
3.1.0 791 2/21/2024
3.0.1 52,044 2/6/2024
3.0.0 29,489 1/31/2024
2.7.1 33,908 2/6/2024
2.7.0 204,687 12/2/2023
2.6.6 667,561 5/2/2023
2.6.5 4,220 4/28/2023
2.6.4 281,961 1/29/2023
2.6.3 1,491 1/29/2023
2.6.2 1,135 1/29/2023
2.6.1 1,228 1/29/2023
2.6.0 90,147 1/18/2023
2.5.7 103,007 1/1/2023
2.5.6 350,427 11/24/2022
2.5.5 51,416 11/4/2022
2.5.4 428,554 7/3/2022
2.5.3 1,403,391 1/27/2021
2.5.2 83,012 1/3/2021
2.5.2-preview1 1,569 12/4/2020
2.5.1 47,024 12/2/2020
2.5.0 2,286 12/2/2020
2.5.0-preview3 1,296 11/30/2020
2.5.0-preview2 1,254 11/30/2020
2.5.0-preview1 1,246 11/14/2020
2.4.5 276,005 11/17/2020
2.4.4 325,822 8/25/2020
2.4.3 260,127 3/25/2020
2.4.2 59,815 2/25/2020
2.4.1 208,915 10/16/2019
2.4.0 195,382 9/15/2019
2.3.0 83,837 7/10/2019
2.2.4 89,693 6/15/2019
2.2.3 13,322 5/25/2019
2.2.2 10,131 5/17/2019
2.2.0 76,686 5/16/2019
2.1.14 17,046 5/3/2019
2.1.13 11,107 4/21/2019
2.1.12 43,975 12/31/2018
2.1.11 2,149 12/30/2018
2.1.10 243,097 9/22/2018
2.1.9 25,430 9/16/2018
2.1.8 75,552 6/18/2018
2.1.7 4,099 6/12/2018
2.1.5 103,204 5/30/2018
2.1.3 2,564 5/29/2018
2.1.2 4,681 5/24/2018
2.1.1 12,594 5/23/2018
2.1.0.7 45,576 4/2/2018
2.1.0.6 2,906 3/26/2018
2.1.0.5 5,452 3/8/2018
2.1.0.4 2,832 3/5/2018
2.1.0.3 2,545 3/5/2018
2.1.0.2 29,801 1/19/2018
2.1.0.1 10,130 1/3/2018
2.1.0 143,215 12/15/2017
2.0.4 2,370 12/12/2017
2.0.2 26,020 9/7/2017
2.0.1 42,706 8/19/2017
2.0.0 6,968 8/15/2017
2.0.0-beta1 3,083 7/12/2017
1.1.1.12 12,361 7/8/2017
1.1.1.11 2,323 7/8/2017
1.1.1.10 8,472 5/20/2017
1.1.1.9 2,384 5/20/2017
1.1.1.8 4,112 4/20/2017
1.1.1.7 7,140 3/18/2017
1.1.1.6 10,720 3/16/2017
1.1.1.5 3,174 3/7/2017
1.1.1.4 2,714 3/7/2017
1.1.1.3 14,210 1/2/2017
1.1.1.2 2,697 12/24/2016
1.1.1.1 3,343 12/20/2016
1.1.1 3,011 12/10/2016
1.1.0.2 3,128 12/10/2016
1.1.0.1 2,820 12/8/2016
1.1.0 2,816 12/5/2016
1.0.0.8 7,248 11/11/2016
1.0.0.7-preview1 2,537 10/26/2016
1.0.0.6 6,314 10/20/2016
1.0.0.5 2,599 10/19/2016
1.0.0.4 2,601 10/18/2016
1.0.0.3 2,625 10/13/2016
1.0.0.2 2,671 9/27/2016
1.0.0.1 2,815 9/26/2016
1.0.0 4,101 3/25/2016