VIEApps.Enyim.Caching 10.10.2511.1

dotnet add package VIEApps.Enyim.Caching --version 10.10.2511.1
                    
NuGet\Install-Package VIEApps.Enyim.Caching -Version 10.10.2511.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="VIEApps.Enyim.Caching" Version="10.10.2511.1" />
                    
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.2511.1" />
                    
Directory.Packages.props
<PackageReference Include="VIEApps.Enyim.Caching" />
                    
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 VIEApps.Enyim.Caching --version 10.10.2511.1
                    
#r "nuget: VIEApps.Enyim.Caching, 10.10.2511.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.
#:package VIEApps.Enyim.Caching@10.10.2511.1
                    
#: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.2511.1
                    
Install as a Cake Addin
#tool nuget:?package=VIEApps.Enyim.Caching&version=10.10.2511.1
                    
Install as a Cake Tool

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

NuGet

Information

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?

See VIEApps.Components.Caching

Product 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 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 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.

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.2511.1 642 11/12/2025
10.9.2511.1 646 11/4/2025
10.9.2510.3 583 10/25/2025
9.0.2510.2 557 10/15/2025
9.0.2510.1 588 9/30/2025
9.0.2509.1 522 9/11/2025
9.0.2508.5 447 8/22/2025
9.0.2508.2 676 8/7/2025
9.0.2508.1 372 8/1/2025
9.0.2507.1 536 7/8/2025
9.0.2506.2 607 6/18/2025
9.0.2506.1 415 5/24/2025
9.0.2505.1 513 4/30/2025
9.0.2504.24 1,599 4/24/2025
9.0.2504.4 573 4/13/2025
9.0.2504.3 556 4/8/2025
9.0.2504.1 710 4/2/2025
9.0.2503.2 497 3/21/2025
9.0.2503.1 582 3/1/2025
9.0.2501.2 5,087 1/24/2025
9.0.2501.1 3,389 12/31/2024
9.0.2412.1 541 12/9/2024
9.0.2411.1 924 11/18/2024
8.0.2410.1 1,207 10/2/2024
8.0.2408.1 5,735 8/1/2024
8.0.2407.1 2,867 6/22/2024
8.0.2406.2 987 5/30/2024
8.0.2406.1 464 5/30/2024
8.0.2404.1 2,379 5/9/2024
8.0.2312.1 7,575 12/22/2023
8.0.2311.1 1,000 11/16/2023
8.0.2310.2 600 10/25/2023
8.0.2310.1 640 9/30/2023
8.0.2309.1 595 9/8/2023
8.0.2308.1 595 8/29/2023
7.0.2307.1 8,433 7/6/2023
7.0.2306.1 1,004 6/6/2023
7.0.2305.1 2,997 5/17/2023
7.0.2303.2 1,814 3/17/2023
7.0.2303.1 1,179 3/2/2023
7.0.2302.1 3,058 1/31/2023
7.0.2301.1 1,918 1/1/2023
7.0.2212.1 2,642 11/30/2022
7.0.2211.1 469 11/27/2022
6.0.2211.1 3,563 11/9/2022
5.0.2211.1 2,153 11/5/2022
5.0.2209.1 4,308 9/20/2022
5.0.2207.1 5,124 7/18/2022
5.0.2205.6 134,106 5/6/2022
5.0.2205.3 2,492 5/5/2022
5.0.2205.1 3,453 4/30/2022
5.0.2204.2 2,966 4/12/2022
5.0.2204.1 2,583 4/10/2022
5.0.2203.5 15,666 3/16/2022
5.0.2203.4 3,186 3/14/2022
5.0.2203.3 3,265 3/10/2022
5.0.2203.2 3,235 3/10/2022
5.0.2203.1 2,999 3/5/2022
5.0.2201.1 22,936 1/3/2022
4.0.2112.1 2,807 12/3/2021
4.0.2111.1 15,643 11/2/2021
4.0.2110.3 3,837 10/13/2021
4.0.2110.2 2,591 9/30/2021
4.0.2110.1 2,139 9/30/2021
4.0.2109.7 2,272 9/22/2021
4.0.2109.6 2,405 9/20/2021
4.0.2109.5 2,238 9/17/2021
4.0.2109.3 3,140 9/16/2021 4.0.2109.3 is deprecated because it has critical bugs.
4.0.2109.2 2,551 9/13/2021 4.0.2109.2 is deprecated because it has critical bugs.
4.0.2109.1 2,318 9/3/2021
4.0.2108.3 2,735 8/2/2021
4.0.2108.2 2,641 8/1/2021
4.0.2108.1 3,760 7/26/2021
4.0.2107.2 2,440 7/17/2021
4.0.2107.1 3,014 7/1/2021
4.0.2106.2 2,142 6/8/2021
4.0.2106.1 2,319 6/6/2021
4.0.2105.1 2,383 5/3/2021
4.0.2104.1 2,076 4/4/2021
4.0.2103.1 2,513 3/9/2021
4.0.2102.2 2,516 2/11/2021
4.0.2102.1 2,342 2/1/2021
3.1.2102.1 1,137 1/20/2021
3.0.2101.1 2,727 12/31/2020
2.0.2012.4 4,310 12/18/2020
2.0.2012.3 3,071 12/17/2020
2.0.2012.1 2,748 12/16/2020
1.8.2012.1 3,779 12/3/2020
1.8.2011.2 3,429 11/15/2020
1.8.2011.1 2,795 11/11/2020
1.7.2010.1 23,024 10/24/2020
1.7.2009.3 73,673 9/9/2020
1.7.2009.2 2,216 9/3/2020
1.7.2009.1 2,251 9/2/2020
1.7.2008.3 2,283 8/21/2020
1.7.2008.2 3,927 8/12/2020
1.7.2008.1 2,760 8/3/2020
1.7.2007.2 3,095 7/15/2020
1.7.2007.1 3,143 6/30/2020
1.7.2006.2 3,368 6/10/2020
1.7.2006.1 3,105 6/2/2020
1.7.2005.2 3,428 5/20/2020
1.7.2005.1 3,973 5/13/2020
1.7.2004.24 2,986 4/24/2020
1.7.2004.1 3,020 3/31/2020
1.7.2003.4 3,240 3/7/2020
1.7.2003.3 2,960 3/5/2020
1.7.2003.2 3,129 3/3/2020
1.7.2002.5 6,275 2/20/2020
1.7.2002.4 3,088 2/19/2020
1.7.2002.3 3,069 2/11/2020
1.7.2002.2 3,079 2/3/2020
1.7.2002.1 3,181 2/2/2020
1.7.2001.4 3,266 1/19/2020
1.7.2001.3 3,119 1/17/2020
1.7.2001.2 6,556 1/6/2020
1.7.2001.1 2,008 1/2/2020
1.7.1912.3 3,024 12/6/2019
1.7.1912.2 1,978 12/4/2019
1.7.1912.1 1,995 12/1/2019
1.7.1911.1 10,059 10/28/2019
1.7.1910.4 3,312 10/17/2019
1.7.1910.3 3,175 10/9/2019
1.7.1910.2 4,090 10/1/2019
1.7.1910.1 2,830 9/26/2019
1.6.1906.2 15,986 6/12/2019
1.6.1906.1 2,978 5/22/2019
1.6.1905.1 3,014 5/7/2019
1.6.1904.3 3,696 4/11/2019
1.6.1904.1 2,533 3/29/2019
1.6.1902.1 6,575 1/31/2019
1.5.1901.2 52,368 1/11/2019
1.5.1901.1 1,945 1/4/2019
1.5.1812.2 2,280 12/4/2018
1.5.1812.1 2,798 12/2/2018
1.5.1811.1 2,340 11/23/2018
1.5.1810.2 2,171 10/25/2018
1.5.1810.1 2,284 10/8/2018
1.5.5.1809 11,239 9/10/2018
1.5.4.1808 5,867 7/24/2018
1.5.3.1806 3,050 5/31/2018
1.5.2.1806 2,798 5/28/2018
1.5.1.1806 2,566 5/17/2018
1.5.0.1805 3,600 5/6/2018
1.4.5.1805 4,486 4/27/2018
1.4.4.1804 1,888 4/11/2018
1.4.3.1802 54,993 2/22/2018
1.4.2.1802 5,661 1/31/2018
1.4.1.1801 3,672 1/5/2018
1.4.0.1801 3,492 12/25/2017
1.3.0.1712 3,306 11/26/2017
1.2.0.1712 2,935 11/10/2017
1.1.2.1711 3,161 11/1/2017
1.1.0 3,864 10/28/2017
1.0.0.1 2,286 10/27/2017

Support .NET 10