You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
LINGYUN.Abp.CachingManagement.StackExchangeRedis
Cache management implementation module based on StackExchange.Redis.
Features
- Implements the
ICacheManagerinterface, providing Redis-based cache management features:- Get cache key list (supports prefix matching and filtering)
- Get cache value
- Set cache value (supports absolute and sliding expiration)
- Refresh cache
- Delete cache
Installation
abp add-module LINGYUN.Abp.CachingManagement
Configuration and Usage
- First, configure the Redis connection string in
appsettings.json:
{
"Redis": {
"Configuration": "127.0.0.1:6379"
}
}
- Add the following code in the
ConfigureServicesmethod of your module:
Configure<RedisCacheOptions>(options =>
{
// Optional: Configure Redis instance name prefix
options.InstanceName = "MyApp:";
});
Configure<AbpDistributedCacheOptions>(options =>
{
// Optional: Configure cache key prefix
options.KeyPrefix = "MyApp:";
});
Multi-tenancy Support
The module has built-in multi-tenancy support, automatically isolating cache data based on the current tenant ID:
- Key format with tenant:
{InstanceName}t:{TenantId}:{KeyPrefix}:{Key} - Key format without tenant:
{InstanceName}c:{KeyPrefix}:{Key}
More
For more information, please refer to the following resources: