VIEApps.Components.Caching
10.9.2511.1
Stack overflow when set multiple items
See the version list below for details.
dotnet add package VIEApps.Components.Caching --version 10.9.2511.1
NuGet\Install-Package VIEApps.Components.Caching -Version 10.9.2511.1
<PackageReference Include="VIEApps.Components.Caching" Version="10.9.2511.1" />
<PackageVersion Include="VIEApps.Components.Caching" Version="10.9.2511.1" />
<PackageReference Include="VIEApps.Components.Caching" />
paket add VIEApps.Components.Caching --version 10.9.2511.1
#r "nuget: VIEApps.Components.Caching, 10.9.2511.1"
#:package VIEApps.Components.Caching@10.9.2511.1
#addin nuget:?package=VIEApps.Components.Caching&version=10.9.2511.1
#tool nuget:?package=VIEApps.Components.Caching&version=10.9.2511.1
VIEApps.Components.Caching
A wrapper component for working with distributed cache
- Ready with .NET Core 2.0+/.NET Framework 4.6.1+
- In-memory cache as L-1 cache
- Supporting distributed cache: Redis & Memcached
NuGet
Dependencies
- Redis: StackExchange.Redis
- Memcached: VIEApps.Enyim.Caching
Configuration (stand-alone/classical apps)
Add the configuration settings into your app.config/web.config file
Configure with two seperated sections
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientConfigurationSectionHandler,Enyim.Caching" />
<section name="redis" type="net.vieapps.Components.Caching.RedisClientConfigurationSectionHandler,VIEApps.Components.Caching" />
</configSections>
<memcached>
<servers>
<add address="192.168.1.2" port="11211" />
<add address="192.168.1.3" port="11211" />
</servers>
<socketPool minPoolSize="10" maxPoolSize="512" deadTimeout="00:01:00" connectionTimeout="00:00:05" receiveTimeout="00:00:05" />
</memcached>
<redis>
<servers>
<add address="192.168.1.4" port="6379" />
<add address="192.168.1.5" port="6379" />
</servers>
<options abortConnect="false" allowAdmin="false" connectTimeout="5000" syncTimeout="2000" />
</redis>
</configuration>
Configure with only one section
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="cache" type="net.vieapps.Components.Caching.CacheConfigurationSectionHandler,VIEApps.Components.Caching" />
</configSections>
<cache provider="Redis" expirationTime="30">
<servers>
<add address="192.168.1.2" port="11211" type="Memcached" />
<add address="192.168.1.3" port="11211" type="Memcached" />
<add address="192.168.1.4" port="6379" type="Redis" />
<add address="192.168.1.5" port="6379" type="Redis" />
</servers>
<socketPool minPoolSize="10" maxPoolSize="512" deadTimeout="00:01:00" connectionTimeout="00:00:05" receiveTimeout="00:00:05" />
<options abortConnect="false" allowAdmin="false" connectTimeout="5000" syncTimeout="2000" />
</cache>
</configuration>
Example of usage (stand-alone/classical apps)
public class CreativeService
{
using net.vieapps.Components.Caching;
Cache _cache;
Cache _memcached;
Cache _redis;
public CreativeService()
{
this._cache = new Cache("Region-Name"); // with default caching provider is 'Redis'
this._memcached = new Cache("Region-Name", "memcached");
this._redis = new Cache("Region-Name", "redis");
}
public async Task<IList<CreativeDTO>> GetCreativesAsync(string unitName)
{
return await this._cache.GetAsync<IList<CreativeDTO>>($"creatives_{unitName}");
}
public async Task<IList<CreativeDTO>> GetMemcachedCreativesAsync(string unitName)
{
return await this._memcached.GetAsync<IList<CreativeDTO>>($"creatives_{unitName}");
}
public async Task<IList<CreativeDTO>> GetRedisCreativesAsync(string unitName)
{
return await this._redis.GetAsync<IList<CreativeDTO>>($"creatives_{unitName}");
}
}
Configuration (ASP.NET Core 2.0+ apps)
TBD
Example of usage (ASP.NET Core 2.0+ apps)
TBD
Listing of all methods
bool Set(string key, object value, int expirationTime = 0);
bool Set(string key, object value, TimeSpan validFor);
bool Set(string key, object value, DateTime expiresAt);
Task<bool> SetAsync(string key, object value, int expirationTime = 0);
Task<bool> SetAsync(string key, object value, TimeSpan validFor);
Task<bool> SetAsync(string key, object value, DateTime expiresAt);
void Set(IDictionary<string, object> items, string keyPrefix = null, int expirationTime = 0);
void Set<T>(IDictionary<string, T> items, string keyPrefix = null, int expirationTime = 0);
Task SetAsync(IDictionary<string, object> items, string keyPrefix = null, int expirationTime = 0);
Task SetAsync<T>(IDictionary<string, T> items, string keyPrefix = null, int expirationTime = 0);
bool SetFragments(string key, List<byte[]> fragments, int expirationTime = 0);
Task<bool> SetFragmentsAsync(string key, List<byte[]> fragments, int expirationTime = 0);
bool SetAsFragments(string key, object value, int expirationTime = 0);
Task<bool> SetAsFragmentsAsync(string key, object value, int expirationTime = 0);
bool Add(string key, object value, int expirationTime = 0);
bool Add(string key, object value, TimeSpan validFor);
bool Add(string key, object value, DateTime expiresAt);
Task<bool> AddAsync(string key, object value, int expirationTime = 0);
Task<bool> AddAsync(string key, object value, TimeSpan validFor);
Task<bool> AddAsync(string key, object value, DateTime expiresAt);
bool Replace(string key, object value, int expirationTime = 0);
bool Replace(string key, object value, TimeSpan validFor);
bool Replace(string key, object value, DateTime expiresAt);
Task<bool> ReplaceAsync(string key, object value, int expirationTime = 0);
Task<bool> ReplaceAsync(string key, object value, TimeSpan validFor);
Task<bool> ReplaceAsync(string key, object value, DateTime expiresAt);
object Get(string key);
T Get<T>(string key);
Task<object> GetAsync(string key);
Task<T> GetAsync<T>(string key);
IDictionary<string, object> Get(IEnumerable<string> keys);
Task<IDictionary<string, object>> GetAsync(IEnumerable<string> keys);
IDictionary<string, T> Get<T>(IEnumerable<string> keys);
Task<IDictionary<string, T>> GetAsync<T>(IEnumerable<string> keys);
Tuple<int, int> GetFragments(string key);
Task<Tuple<int, int>> GetFragmentsAsync(string key);
List<byte[]> GetAsFragments(string key, List<int> indexes);
Task<List<byte[]>> GetAsFragmentsAsync(string key, List<int> indexes);
List<byte[]> GetAsFragments(string key, params int[] indexes);
Task<List<byte[]>> GetAsFragmentsAsync(string key, params int[] indexes);
bool Remove(string key);
Task<bool> RemoveAsync(string key);
void Remove(IEnumerable<string> keys, string keyPrefix = null);
Task RemoveAsync(IEnumerable<string> keys, string keyPrefix = null);
void RemoveFragments(string key);
Task RemoveFragmentsAsync(string key);
bool Exists(string key);
Task<bool> ExistsAsync(string key);
void Clear();
Task ClearAsync();
HashSet<string> GetKeys();
Task<HashSet<string>> GetKeysAsync();
| 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 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 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Caching.Memory (>= 9.0.10)
- StackExchange.Redis (>= 2.9.32)
- VIEApps.Enyim.Caching (>= 10.9.2511.1)
-
net9.0
- Microsoft.Extensions.Caching.Memory (>= 9.0.10)
- StackExchange.Redis (>= 2.9.32)
- VIEApps.Enyim.Caching (>= 10.9.2511.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on VIEApps.Components.Caching:
| Package | Downloads |
|---|---|
|
VIEApps.Components.Repository
A tiny polyglot component to help POCO objects work with both NoSQL and SQL databases at the same time on .NET |
|
|
VIEApps.Services.Abstractions
The abstractions for all microservices in the VIEApps NGX |
|
|
VIEApps.Components.Utility.AspNetCore
The general purpose components for developing apps with ASP.NET Core |
|
|
VIEApps.Components.Caching.AspNet
ASP.NET Session State with distributed cache (Redis & Memcached) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 10.10.2511.1 | 247 | 11/12/2025 | |
| 10.9.2511.1 | 559 | 11/4/2025 | |
| 10.9.2510.3 | 447 | 10/25/2025 | |
| 10.9.2510.2 | 509 | 10/15/2025 | |
| 10.9.2510.1 | 506 | 9/30/2025 | |
| 10.9.2509.1 | 432 | 9/11/2025 | |
| 10.9.2508.5 | 377 | 8/22/2025 | |
| 10.9.2508.2 | 639 | 8/7/2025 | |
| 10.9.2508.1 | 300 | 8/1/2025 | |
| 10.9.2507.1 | 515 | 7/14/2025 | |
| 10.9.2506.2 | 444 | 6/18/2025 | |
| 10.9.2506.1 | 389 | 5/24/2025 | |
| 10.9.2505.1 | 400 | 4/30/2025 | |
| 10.9.2504.24 | 492 | 4/24/2025 | |
| 10.9.2504.4 | 559 | 4/13/2025 | |
| 10.9.2504.3 | 490 | 4/8/2025 | |
| 10.9.2504.1 | 586 | 4/2/2025 | |
| 10.9.2503.2 | 378 | 3/22/2025 | |
| 10.9.2503.1 | 464 | 3/1/2025 | |
| 10.9.2501.2 | 469 | 1/24/2025 | |
| 10.9.2501.1 | 443 | 12/31/2024 | |
| 10.9.2412.1 | 454 | 12/9/2024 | |
| 10.9.2411.1 | 435 | 11/18/2024 | |
| 10.8.2410.1 | 508 | 10/2/2024 | |
| 10.8.2408.1 | 1,962 | 8/1/2024 | |
| 10.8.2407.1 | 477 | 6/22/2024 | |
| 10.8.2406.2 | 660 | 5/30/2024 | |
| 10.8.2406.1 | 331 | 5/30/2024 | |
| 10.8.2404.1 | 1,976 | 5/9/2024 | |
| 10.8.2312.1 | 1,102 | 12/22/2023 | |
| 10.8.2311.1 | 518 | 11/16/2023 | |
| 10.8.2310.2 | 546 | 10/25/2023 | |
| 10.8.2310.1 | 547 | 9/30/2023 | |
| 10.8.2309.1 | 498 | 9/8/2023 | |
| 10.8.2308.1 | 563 | 8/29/2023 | |
| 10.7.2307.1 | 5,417 | 7/6/2023 | |
| 10.7.2306.1 | 840 | 6/6/2023 | |
| 10.7.2305.1 | 563 | 5/17/2023 | |
| 10.7.2303.2 | 774 | 3/17/2023 | |
| 10.7.2303.1 | 873 | 3/2/2023 | |
| 10.7.2302.1 | 1,207 | 1/31/2023 | |
| 10.7.2301.1 | 1,274 | 1/2/2023 | |
| 10.7.2212.1 | 2,125 | 11/30/2022 | |
| 10.7.2211.1 | 1,546 | 11/27/2022 | |
| 10.6.2211.1 | 1,605 | 11/9/2022 | |
| 10.5.2211.1 | 1,603 | 11/5/2022 | |
| 10.5.2209.1 | 3,459 | 9/20/2022 | |
| 10.5.2207.1 | 4,397 | 7/18/2022 | |
| 10.5.2205.6 | 2,174 | 5/6/2022 | |
| 10.5.2205.3 | 2,182 | 5/5/2022 | |
| 10.5.2205.1 | 2,921 | 4/30/2022 | |
| 10.5.2204.2 | 2,276 | 4/12/2022 | |
| 10.5.2204.1 | 2,241 | 4/10/2022 | |
| 10.5.2203.5 | 2,610 | 3/16/2022 | |
| 10.5.2203.4 | 2,544 | 3/14/2022 | |
| 10.5.2203.3 | 2,614 | 3/10/2022 | |
| 10.5.2203.2 | 2,620 | 3/10/2022 | |
| 10.5.2203.1 | 2,615 | 3/5/2022 | |
| 10.5.2201.1 | 2,792 | 1/3/2022 | |
| 10.4.2112.1 | 1,796 | 12/3/2021 | |
| 10.4.2111.1 | 2,012 | 11/2/2021 | |
| 10.4.2110.3 | 1,963 | 10/13/2021 | |
| 10.4.2110.2 | 1,974 | 9/30/2021 | |
| 10.4.2110.1 | 2,064 | 9/30/2021 | |
| 10.4.2109.7 | 1,758 | 9/22/2021 | |
| 10.4.2109.6 | 2,006 | 9/20/2021 | |
| 10.4.2109.5 | 1,813 | 9/17/2021 | |
| 10.4.2109.3 | 2,726 | 9/16/2021 | |
| 10.4.2109.2 | 2,153 | 9/13/2021 | |
| 10.4.2109.1 | 1,936 | 9/3/2021 | |
| 10.4.2108.3 | 2,023 | 8/2/2021 | |
| 10.4.2108.2 | 2,218 | 8/1/2021 | |
| 10.4.2108.1 | 1,960 | 7/26/2021 | |
| 10.4.2107.2 | 1,949 | 7/17/2021 | |
| 10.4.2107.1 | 2,016 | 7/1/2021 | |
| 10.4.2106.2 | 1,909 | 6/8/2021 | |
| 10.4.2106.1 | 1,905 | 6/6/2021 | |
| 10.4.2105.1 | 1,889 | 5/3/2021 | |
| 10.4.2104.1 | 1,213 | 4/4/2021 | |
| 10.4.2103.1 | 1,988 | 3/9/2021 | |
| 10.4.2102.1 | 1,937 | 2/1/2021 | |
| 10.4.2101.1 | 2,065 | 12/31/2020 | |
| 10.3.2012.5 | 2,478 | 12/23/2020 | |
| 10.3.2012.4 | 1,972 | 12/18/2020 | |
| 10.3.2012.3 | 2,857 | 12/17/2020 | |
| 10.3.2012.2 | 2,243 | 12/16/2020 | |
| 10.3.2012.1 | 1,977 | 12/3/2020 | |
| 10.3.2011.2 | 2,291 | 11/15/2020 | |
| 10.3.2011.1 | 2,353 | 11/11/2020 | |
| 10.3.2010.1 | 1,660 | 10/24/2020 | |
| 10.3.2009.3 | 1,723 | 9/9/2020 | |
| 10.3.2009.2 | 1,715 | 9/3/2020 | |
| 10.3.2009.1 | 1,777 | 9/2/2020 | |
| 10.3.2008.3 | 1,785 | 8/21/2020 | |
| 10.3.2008.2 | 1,883 | 8/12/2020 | |
| 10.3.2008.1 | 2,045 | 8/3/2020 | |
| 10.3.2007.2 | 2,590 | 7/15/2020 | |
| 10.3.2007.1 | 2,610 | 6/30/2020 | |
| 10.3.2006.2 | 2,431 | 6/10/2020 | |
| 10.3.2006.1 | 2,564 | 6/2/2020 | |
| 10.3.2005.2 | 2,587 | 5/20/2020 | |
| 10.3.2005.1 | 2,500 | 5/13/2020 | |
| 10.3.2004.24 | 2,510 | 4/24/2020 | |
| 10.3.2004.1 | 2,556 | 3/31/2020 | |
| 10.3.2003.4 | 2,679 | 3/7/2020 | |
| 10.3.2003.3 | 2,494 | 3/5/2020 | |
| 10.3.2003.2 | 2,623 | 3/3/2020 | |
| 10.3.2002.5 | 5,795 | 2/20/2020 | |
| 10.3.2002.4 | 2,750 | 2/19/2020 | |
| 10.3.2002.3 | 2,655 | 2/11/2020 | |
| 10.3.2002.2 | 2,568 | 2/3/2020 | |
| 10.3.2002.1 | 2,656 | 2/2/2020 | |
| 10.3.2001.4 | 2,714 | 1/19/2020 | |
| 10.3.2001.3 | 2,581 | 1/17/2020 | |
| 10.3.2001.2 | 3,792 | 1/6/2020 | |
| 10.3.2001.1 | 1,455 | 1/2/2020 | |
| 10.3.1912.3 | 1,681 | 12/6/2019 | |
| 10.3.1912.2 | 1,445 | 12/4/2019 | |
| 10.3.1912.1 | 1,447 | 12/1/2019 | |
| 10.3.1911.1 | 2,586 | 10/28/2019 | |
| 10.3.1910.4 | 2,856 | 10/17/2019 | |
| 10.3.1910.3 | 2,751 | 10/9/2019 | |
| 10.3.1910.2 | 2,762 | 10/1/2019 | |
| 10.3.1910.1 | 2,620 | 9/26/2019 | |
| 10.3.1909.1-preview | 586 | 9/10/2019 | |
| 10.3.1908.1-preview | 1,063 | 8/3/2019 | |
| 10.3.1907.1-preview | 756 | 7/2/2019 | |
| 10.3.1906.5-preview | 995 | 6/21/2019 | |
| 10.3.1906.4-preview | 835 | 6/20/2019 | |
| 10.3.1906.3-preview | 909 | 6/18/2019 | |
| 10.3.1906.2-preview | 821 | 6/17/2019 | |
| 10.3.1906.1-preview | 895 | 6/17/2019 | |
| 10.2.1906.2 | 2,137 | 6/12/2019 | |
| 10.2.1906.1 | 2,346 | 5/22/2019 | |
| 10.2.1905.2 | 2,308 | 5/7/2019 | |
| 10.2.1905.1 | 1,650 | 5/1/2019 | |
| 10.2.1904.3 | 1,643 | 4/11/2019 | |
| 10.2.1904.1 | 1,962 | 3/29/2019 | |
| 10.2.1903.3 | 1,636 | 3/6/2019 | |
| 10.2.1903.1 | 2,398 | 2/28/2019 | |
| 10.2.1902.2 | 1,695 | 2/22/2019 | |
| 10.2.1902.1 | 1,763 | 1/31/2019 | |
| 10.2.1901.2 | 1,720 | 1/11/2019 | |
| 10.2.1901.1 | 1,719 | 1/7/2019 | |
| 10.2.1812.2 | 1,617 | 12/4/2018 | |
| 10.2.1812.1 | 1,770 | 12/2/2018 | |
| 10.2.1811.2 | 1,689 | 11/23/2018 | |
| 10.2.1811.1 | 1,694 | 11/12/2018 | |
| 10.2.1810.1 | 1,763 | 10/8/2018 | |
| 10.2.6.1809 | 1,748 | 9/10/2018 | |
| 10.2.5.1808 | 1,919 | 7/24/2018 | |
| 10.2.4.1806 | 2,242 | 5/31/2018 | |
| 10.2.3.1806 | 2,185 | 5/28/2018 | |
| 10.2.2.1806 | 2,055 | 5/17/2018 | |
| 10.2.1.1805 | 2,892 | 5/7/2018 | |
| 10.1.19.1805 | 2,673 | 5/1/2018 | |
| 10.1.14.1804 | 2,788 | 3/31/2018 | |
| 10.1.12.1802 | 3,109 | 2/22/2018 | |
| 10.1.8.1802 | 3,451 | 2/7/2018 | |
| 10.1.7.1802 | 2,678 | 1/31/2018 | |
| 10.1.6.1801 | 2,537 | 1/5/2018 | |
| 10.1.5.1801 | 2,834 | 12/25/2017 | |
| 10.1.5.1801-rc | 2,179 | 11/30/2017 | |
| 10.1.4.1712 | 2,622 | 11/26/2017 | |
| 10.1.3.1712 | 2,851 | 11/10/2017 | |
| 10.1.1.1711 | 2,356 | 11/1/2017 | |
| 10.1.0.3 | 1,970 | 10/31/2017 | |
| 10.1.0.1 | 2,395 | 10/30/2017 |
L1-Cache