VIEApps.Enyim.Caching
10.10.2603.3
dotnet add package VIEApps.Enyim.Caching --version 10.10.2603.3
NuGet\Install-Package VIEApps.Enyim.Caching -Version 10.10.2603.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="VIEApps.Enyim.Caching" Version="10.10.2603.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VIEApps.Enyim.Caching" Version="10.10.2603.3" />
<PackageReference Include="VIEApps.Enyim.Caching" />
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 VIEApps.Enyim.Caching --version 10.10.2603.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: VIEApps.Enyim.Caching, 10.10.2603.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 VIEApps.Enyim.Caching@10.10.2603.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=VIEApps.Enyim.Caching&version=10.10.2603.3
#tool nuget:?package=VIEApps.Enyim.Caching&version=10.10.2603.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
VIEApps.Enyim.Caching
The high-performance memcached client library:
- 100% compatible with EnyimMemcached 2.x
- Fully async (EnyimMemcached still blocks threads while reading from sockets/response)
- Multiple nodes supported with Ketama for better distribution
- Object serialization by various transcoders: Json.NET Bson, Protocol Buffers, MessagePack
- More useful methods (Set, Add, Replace, Refresh, Exists)
NuGet
Information
- Migrated from the fork EnyimMemcachedCore (.NET Core 2.0)
- Reference from the original EnyimMemcached (.NET Framework 3.5)
Usage of ASP.NET Core 2.x+ apps
- Add services.AddMemcached(...) and app.UseMemcached() in Startup.cs
- Add IMemcachedClient or IDistributedCache into constructor (using dependency injection)
Configure (by the appsettings.json file) without authentication
{
"Memcached": {
"Servers": [
{
"Address": "192.168.0.2",
"Port": 11211
},
{
"Address": "192.168.0.3",
"Port": 11211
}],
"SocketPool": {
"MinPoolSize": 10,
"MaxPoolSize": 100,
"DeadTimeout": "00:01:00",
"ConnectionTimeout": "00:00:05",
"ReceiveTimeout": "00:00:01"
}
}
}
Configure (by the appsettings.json file) with authentication
{
"Memcached": {
"Servers": [
{
"Address": "192.168.0.2",
"Port": 11211
},
{
"Address": "192.168.0.3",
"Port": 11211
}],
"SocketPool": {
"MinPoolSize": 10,
"MaxPoolSize": 100,
"DeadTimeout": "00:01:00",
"ConnectionTimeout": "00:00:05",
"ReceiveTimeout": "00:00:01"
},
"Authentication": {
"Type": "Enyim.Caching.Memcached.PlainTextAuthenticator, Enyim.Caching",
"Parameters": {
"zone": "",
"userName": "username",
"password": "password"
}
}
}
}
Startup.cs
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// ....
services.AddMemcached(options => Configuration.GetSection("Memcached").Bind(options));
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// ....
app.UseMemcached();
}
}
Use IMemcachedClient interface
public class TabNavService
{
ITabNavRepository _tabNavRepository;
IMemcachedClient _cache;
public TabNavService(ITabNavRepository tabNavRepository, IMemcachedClient cache)
{
_tabNavRepository = tabNavRepository;
_cache = cache;
}
public async Task<IEnumerable<TabNav>> GetAllAsync()
{
var cacheKey = "aboutus_tabnavs_all";
var result = await _cache.GetAsync<IEnumerable<TabNav>>(cacheKey);
if (result == null)
{
var tabNavs = await _tabNavRepository.GetAll();
await _cache.SetAsync(cacheKey, tabNavs, TimeSpan.FromMinutes(30));
return tabNavs;
}
else
return result;
}
}
Use IDistributedCache interface
public class CreativeService
{
ICreativeRepository _creativeRepository;
IDistributedCache _cache;
public CreativeService(ICreativeRepository creativeRepository, IDistributedCache cache)
{
_creativeRepository = creativeRepository;
_cache = cache;
}
public async Task<IList<CreativeDTO>> GetCreativesAsync(string unitName)
{
var cacheKey = $"creatives_{unitName}";
IList<CreativeDTO> creatives = null;
var creativesBytes = await _cache.GetAsync(cacheKey);
var creativesJson = creativesBytes != null ? System.Text.Encoding.UTF8.GetString(creativesBytes) : null;
if (creativesJson == null)
{
creatives = await _creativeRepository.GetCreatives(unitName).ProjectTo<CreativeDTO>().ToListAsync();
var json = creatives != null && creatives.Count() > 0 ? JsonConvert.SerializeObject(creatives) : string.Empty;
creativesBytes = System.Text.Encoding.UTF8.GetBytes(json);
await _cache.SetAsync(cacheKey, creativesBytes, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(30)));
}
else
creatives = JsonConvert.DeserializeObject<List<CreativeDTO>>(creativesJson);
return creatives;
}
}
Usage of .NET Core 2.x+/.NET Framework 4.6.1+ standalone apps
Configure (by the app.config/web.config) without authentication
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientConfigurationSectionHandler, VIEApps.Components.Enyim.Caching" />
</configSections>
<memcached>
<servers>
<add address="192.168.0.2" port="11211" />
<add address="192.168.0.3" port="11211" />
</servers>
<socketPool minPoolSize="10" maxPoolSize="100" deadTimeout="00:01:00" connectionTimeout="00:00:05" receiveTimeout="00:00:01" />
</memcached>
</configuration>
Configure (by the app.config/web.config) with authentication
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientConfigurationSectionHandler, VIEApps.Components.Enyim.Caching" />
</configSections>
<memcached>
<servers>
<add address="192.168.0.2" port="11211" />
<add address="192.168.0.3" port="11211" />
</servers>
<socketPool minPoolSize="10" maxPoolSize="100" deadTimeout="00:01:00" connectionTimeout="00:00:05" receiveTimeout="00:00:01" />
<authentication type="Enyim.Caching.Memcached.PlainTextAuthenticator, VIEApps.Components.Enyim.Caching" zone="" userName="username" password="password" />
</memcached>
</configuration>
Example
public class CreativeService
{
MemcachedClient _cache;
public CreativeService()
{
_cache = new MemcachedClient(ConfigurationManager.GetSection("memcached") as MemcachedClientConfigurationSectionHandler);
}
public async Task<IList<CreativeDTO>> GetCreativesAsync(string unitName)
{
return await _cache.GetAsync<IList<CreativeDTO>>($"creatives_{unitName}");
}
}
Other transcoders (Protocol Buffers, Json.NET Bson, MessagePack)
See VIEApps.Enyim.Caching.Transcoders
Need a library for working with other distributed cache (Redis) in the same time?
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 was computed. 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 Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.9)
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyModel (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- MsgPack.Cli (>= 1.0.1)
- Newtonsoft.Json (>= 13.0.4)
- Newtonsoft.Json.Bson (>= 1.0.3)
- System.Configuration.ConfigurationManager (>= 10.0.0)
- System.Runtime.Loader (>= 4.3.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on VIEApps.Enyim.Caching:
| Package | Downloads |
|---|---|
|
VIEApps.Components.Caching
Distributed cache (Redis & Memcached) on .NET |
|
|
VIEApps.Enyim.Caching.Transcoders
The custom transcoders for VIEApps Enyim Caching (Json.NET Bson, MessagePack and Protocol Buffers) |
|
|
PipServices.Memcached
Memcached components for Pip.Services in .NET |
|
|
PipServices3.Memcached
Memcached components for Pip.Services in .NET |
|
|
PipServices4.Memcached
Memcached components for Pip.Services in .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.10.2603.3 | 724 | 3/8/2026 |
| 10.10.2603.2 | 813 | 3/2/2026 |
| 10.10.2603.1 | 760 | 3/2/2026 |
| 10.10.2602.1 | 1,051 | 2/6/2026 |
| 10.10.2601.1 | 867 | 1/1/2026 |
| 10.10.2512.2 | 855 | 12/10/2025 |
| 10.10.2512.1 | 594 | 11/27/2025 |
| 10.10.2511.1 | 723 | 11/12/2025 |
| 10.9.2511.1 | 718 | 11/4/2025 |
| 10.9.2510.3 | 641 | 10/25/2025 |
| 9.0.2510.2 | 609 | 10/15/2025 |
| 9.0.2510.1 | 641 | 9/30/2025 |
| 9.0.2509.1 | 694 | 9/11/2025 |
| 9.0.2508.5 | 496 | 8/22/2025 |
| 9.0.2508.2 | 734 | 8/7/2025 |
| 9.0.2508.1 | 431 | 8/1/2025 |
| 9.0.2507.1 | 584 | 7/8/2025 |
| 9.0.2506.2 | 658 | 6/18/2025 |
| 9.0.2506.1 | 477 | 5/24/2025 |
| 9.0.2505.1 | 565 | 4/30/2025 |
Loading failed
Latest components