VIEApps.Components.Caching
10.10.2603.2
dotnet add package VIEApps.Components.Caching --version 10.10.2603.2
NuGet\Install-Package VIEApps.Components.Caching -Version 10.10.2603.2
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.Components.Caching" Version="10.10.2603.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VIEApps.Components.Caching" Version="10.10.2603.2" />
<PackageReference Include="VIEApps.Components.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.Components.Caching --version 10.10.2603.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: VIEApps.Components.Caching, 10.10.2603.2"
#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.Components.Caching@10.10.2603.2
#: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.Components.Caching&version=10.10.2603.2
#tool nuget:?package=VIEApps.Components.Caching&version=10.10.2603.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 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.Extensions.Caching.Memory (>= 10.0.0)
- StackExchange.Redis (>= 2.11.8)
- VIEApps.Enyim.Caching (>= 10.10.2603.2)
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.2603.2 | 0 | 3/2/2026 | |
| 10.10.2603.1 | 0 | 3/2/2026 | |
| 10.10.2602.1 | 1,033 | 2/6/2026 | |
| 10.10.2601.1 | 402 | 1/1/2026 | |
| 10.10.2512.2 | 788 | 12/10/2025 | |
| 10.10.2512.1 | 513 | 11/27/2025 | |
| 10.10.2511.1 | 617 | 11/12/2025 | |
| 10.9.2511.1 | 621 | 11/4/2025 | |
| 10.9.2510.3 | 508 | 10/25/2025 | |
| 10.9.2510.2 | 562 | 10/15/2025 | |
| 10.9.2510.1 | 566 | 9/30/2025 | |
| 10.9.2509.1 | 486 | 9/11/2025 | |
| 10.9.2508.5 | 433 | 8/22/2025 | |
| 10.9.2508.2 | 694 | 8/7/2025 | |
| 10.9.2508.1 | 360 | 8/1/2025 | |
| 10.9.2507.1 | 572 | 7/14/2025 | |
| 10.9.2506.2 | 505 | 6/18/2025 | |
| 10.9.2506.1 | 449 | 5/24/2025 | |
| 10.9.2505.1 | 460 | 4/30/2025 | |
| 10.9.2504.24 | 549 | 4/24/2025 |
Loading failed
Latest components