10 changed files with 480 additions and 0 deletions
@ -0,0 +1,36 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.Application.Contracts |
||||
|
|
||||
|
Cache management application service contract module. |
||||
|
|
||||
|
## Interfaces |
||||
|
|
||||
|
### ICacheAppService |
||||
|
|
||||
|
Cache management application service interface, providing the following features: |
||||
|
|
||||
|
* `GetKeysAsync`: Get cache key list |
||||
|
* `GetValueAsync`: Get cache value |
||||
|
* `SetAsync`: Set cache value |
||||
|
* `RefreshAsync`: Refresh cache |
||||
|
* `RemoveAsync`: Remove cache |
||||
|
|
||||
|
## Permissions |
||||
|
|
||||
|
* AbpCachingManagement.Cache: Cache management |
||||
|
* AbpCachingManagement.Cache.Refresh: Refresh cache |
||||
|
* AbpCachingManagement.Cache.Delete: Delete cache |
||||
|
* AbpCachingManagement.Cache.ManageValue: Manage cache value |
||||
|
|
||||
|
## Installation |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## More |
||||
|
|
||||
|
For more information, please refer to the following resources: |
||||
|
|
||||
|
* [Application Service Implementation](../LINGYUN.Abp.CachingManagement.Application/README.EN.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.EN.md) |
||||
|
* [Domain Layer](../LINGYUN.Abp.CachingManagement.Domain/README.EN.md) |
||||
@ -0,0 +1,36 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.Application.Contracts |
||||
|
|
||||
|
缓存管理应用服务契约模块。 |
||||
|
|
||||
|
## 接口 |
||||
|
|
||||
|
### ICacheAppService |
||||
|
|
||||
|
缓存管理应用服务接口,提供以下功能: |
||||
|
|
||||
|
* `GetKeysAsync`: 获取缓存键列表 |
||||
|
* `GetValueAsync`: 获取缓存值 |
||||
|
* `SetAsync`: 设置缓存值 |
||||
|
* `RefreshAsync`: 刷新缓存 |
||||
|
* `RemoveAsync`: 删除缓存 |
||||
|
|
||||
|
## 权限 |
||||
|
|
||||
|
* AbpCachingManagement.Cache:缓存管理 |
||||
|
* AbpCachingManagement.Cache.Refresh:刷新缓存 |
||||
|
* AbpCachingManagement.Cache.Delete:删除缓存 |
||||
|
* AbpCachingManagement.Cache.ManageValue:管理缓存值 |
||||
|
|
||||
|
## 安装 |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## 更多 |
||||
|
|
||||
|
有关更多信息,请参阅以下资源: |
||||
|
|
||||
|
* [应用服务实现](../LINGYUN.Abp.CachingManagement.Application/README.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.md) |
||||
|
* [领域层](../LINGYUN.Abp.CachingManagement.Domain/README.md) |
||||
@ -0,0 +1,46 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.Application |
||||
|
|
||||
|
Implementation of the cache management application service module. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Implements the `ICacheAppService` interface, providing basic cache management functions: |
||||
|
* Get cache key list |
||||
|
* Get cache value |
||||
|
* Set cache value |
||||
|
* Refresh cache |
||||
|
* Delete cache |
||||
|
|
||||
|
## Permissions |
||||
|
|
||||
|
* AbpCachingManagement.Cache: Cache management |
||||
|
* AbpCachingManagement.Cache.Refresh: Refresh cache |
||||
|
* AbpCachingManagement.Cache.Delete: Delete cache |
||||
|
* AbpCachingManagement.Cache.ManageValue: Manage cache value |
||||
|
|
||||
|
## Installation |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## Configuration and Usage |
||||
|
|
||||
|
1. First, you need to install the corresponding cache implementation module, for example: [LINGYUN.Abp.CachingManagement.StackExchangeRedis](../LINGYUN.Abp.CachingManagement.StackExchangeRedis/README.EN.md) |
||||
|
|
||||
|
2. Add the following code in the `ConfigureServices` method of your module: |
||||
|
|
||||
|
```csharp |
||||
|
Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddProfile<AbpCachingManagementApplicationAutoMapperProfile>(validate: true); |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
## More |
||||
|
|
||||
|
For more information, please refer to the following resources: |
||||
|
|
||||
|
* [Application Service Contracts](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.EN.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.EN.md) |
||||
|
* [Domain Layer](../LINGYUN.Abp.CachingManagement.Domain/README.EN.md) |
||||
@ -0,0 +1,46 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.Application |
||||
|
|
||||
|
缓存管理应用服务模块的实现。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 实现了 `ICacheAppService` 接口,提供缓存管理的基本功能: |
||||
|
* 获取缓存键列表 |
||||
|
* 获取缓存值 |
||||
|
* 设置缓存值 |
||||
|
* 刷新缓存 |
||||
|
* 删除缓存 |
||||
|
|
||||
|
## 权限 |
||||
|
|
||||
|
* AbpCachingManagement.Cache:缓存管理 |
||||
|
* AbpCachingManagement.Cache.Refresh:刷新缓存 |
||||
|
* AbpCachingManagement.Cache.Delete:删除缓存 |
||||
|
* AbpCachingManagement.Cache.ManageValue:管理缓存值 |
||||
|
|
||||
|
## 安装 |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
1. 首先需要安装相应的缓存实现模块,例如:[LINGYUN.Abp.CachingManagement.StackExchangeRedis](../LINGYUN.Abp.CachingManagement.StackExchangeRedis/README.md) |
||||
|
|
||||
|
2. 在模块的 `ConfigureServices` 方法中添加以下代码: |
||||
|
|
||||
|
```csharp |
||||
|
Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddProfile<AbpCachingManagementApplicationAutoMapperProfile>(validate: true); |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
## 更多 |
||||
|
|
||||
|
有关更多信息,请参阅以下资源: |
||||
|
|
||||
|
* [应用服务契约](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.md) |
||||
|
* [领域层](../LINGYUN.Abp.CachingManagement.Domain/README.md) |
||||
@ -0,0 +1,44 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.Domain |
||||
|
|
||||
|
Domain layer implementation of the cache management module. |
||||
|
|
||||
|
## Core Interfaces |
||||
|
|
||||
|
### ICacheManager |
||||
|
|
||||
|
Cache manager interface, defining core cache management functionality: |
||||
|
|
||||
|
* `GetKeysAsync`: Get cache key list |
||||
|
* `GetValueAsync`: Get cache value |
||||
|
* `SetAsync`: Set cache value |
||||
|
* `RefreshAsync`: Refresh cache |
||||
|
* `RemoveAsync`: Remove cache |
||||
|
|
||||
|
## Domain Services |
||||
|
|
||||
|
### CacheManager |
||||
|
|
||||
|
Abstract base class for cache manager, providing basic cache management implementation. Specific cache providers (like Redis) need to inherit this class and implement the corresponding methods. |
||||
|
|
||||
|
## Installation |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## Extension Development |
||||
|
|
||||
|
To support a new cache provider, you need to: |
||||
|
|
||||
|
1. Create a new project, inherit from `CacheManager` class |
||||
|
2. Implement all abstract methods |
||||
|
3. Register as implementation of `ICacheManager` (using `[Dependency(ReplaceServices = true)]`) |
||||
|
|
||||
|
## More |
||||
|
|
||||
|
For more information, please refer to the following resources: |
||||
|
|
||||
|
* [Application Service Implementation](../LINGYUN.Abp.CachingManagement.Application/README.EN.md) |
||||
|
* [Application Service Contracts](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.EN.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.EN.md) |
||||
|
* [Redis Implementation](../LINGYUN.Abp.CachingManagement.StackExchangeRedis/README.EN.md) |
||||
@ -0,0 +1,44 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.Domain |
||||
|
|
||||
|
缓存管理模块的领域层实现。 |
||||
|
|
||||
|
## 核心接口 |
||||
|
|
||||
|
### ICacheManager |
||||
|
|
||||
|
缓存管理器接口,定义了缓存管理的核心功能: |
||||
|
|
||||
|
* `GetKeysAsync`: 获取缓存键列表 |
||||
|
* `GetValueAsync`: 获取缓存值 |
||||
|
* `SetAsync`: 设置缓存值 |
||||
|
* `RefreshAsync`: 刷新缓存 |
||||
|
* `RemoveAsync`: 删除缓存 |
||||
|
|
||||
|
## 领域服务 |
||||
|
|
||||
|
### CacheManager |
||||
|
|
||||
|
缓存管理器的抽象基类,提供了基础的缓存管理实现。具体的缓存提供程序(如Redis)需要继承此类并实现相应的方法。 |
||||
|
|
||||
|
## 安装 |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## 扩展开发 |
||||
|
|
||||
|
如果需要支持新的缓存提供程序,需要: |
||||
|
|
||||
|
1. 创建新的项目,继承 `CacheManager` 类 |
||||
|
2. 实现所有抽象方法 |
||||
|
3. 注册为 `ICacheManager` 的实现(使用 `[Dependency(ReplaceServices = true)]`) |
||||
|
|
||||
|
## 更多 |
||||
|
|
||||
|
有关更多信息,请参阅以下资源: |
||||
|
|
||||
|
* [应用服务实现](../LINGYUN.Abp.CachingManagement.Application/README.md) |
||||
|
* [应用服务契约](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.md) |
||||
|
* [Redis实现](../LINGYUN.Abp.CachingManagement.StackExchangeRedis/README.md) |
||||
@ -0,0 +1,53 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.HttpApi |
||||
|
|
||||
|
HTTP API implementation for the cache management module. |
||||
|
|
||||
|
## API Endpoints |
||||
|
|
||||
|
### /api/caching-management/cache |
||||
|
|
||||
|
* GET `/api/caching-management/cache/keys`: Get cache key list |
||||
|
* Parameters: |
||||
|
* prefix (string, optional): Key prefix |
||||
|
* filter (string, optional): Filter condition |
||||
|
* marker (string, optional): Pagination marker |
||||
|
* Permission: AbpCachingManagement.Cache |
||||
|
|
||||
|
* GET `/api/caching-management/cache/{key}`: Get cache value for specified key |
||||
|
* Parameters: |
||||
|
* key (string, required): Cache key |
||||
|
* Permission: AbpCachingManagement.Cache |
||||
|
|
||||
|
* POST `/api/caching-management/cache`: Set cache value |
||||
|
* Parameters: |
||||
|
* key (string, required): Cache key |
||||
|
* value (string, required): Cache value |
||||
|
* absoluteExpiration (DateTime, optional): Absolute expiration time |
||||
|
* slidingExpiration (DateTime, optional): Sliding expiration time |
||||
|
* Permission: AbpCachingManagement.Cache.ManageValue |
||||
|
|
||||
|
* PUT `/api/caching-management/cache/refresh`: Refresh cache |
||||
|
* Parameters: |
||||
|
* key (string, required): Cache key |
||||
|
* absoluteExpiration (DateTime, optional): Absolute expiration time |
||||
|
* slidingExpiration (DateTime, optional): Sliding expiration time |
||||
|
* Permission: AbpCachingManagement.Cache.Refresh |
||||
|
|
||||
|
* DELETE `/api/caching-management/cache`: Delete cache |
||||
|
* Parameters: |
||||
|
* key (string, required): Cache key |
||||
|
* Permission: AbpCachingManagement.Cache.Delete |
||||
|
|
||||
|
## Installation |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## More |
||||
|
|
||||
|
For more information, please refer to the following resources: |
||||
|
|
||||
|
* [Application Service Implementation](../LINGYUN.Abp.CachingManagement.Application/README.EN.md) |
||||
|
* [Application Service Contracts](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.EN.md) |
||||
|
* [Domain Layer](../LINGYUN.Abp.CachingManagement.Domain/README.EN.md) |
||||
@ -0,0 +1,53 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.HttpApi |
||||
|
|
||||
|
缓存管理模块的 HTTP API 实现。 |
||||
|
|
||||
|
## API 接口 |
||||
|
|
||||
|
### /api/caching-management/cache |
||||
|
|
||||
|
* GET `/api/caching-management/cache/keys`: 获取缓存键列表 |
||||
|
* 参数: |
||||
|
* prefix (string, optional): 键前缀 |
||||
|
* filter (string, optional): 过滤条件 |
||||
|
* marker (string, optional): 分页标记 |
||||
|
* 权限:AbpCachingManagement.Cache |
||||
|
|
||||
|
* GET `/api/caching-management/cache/{key}`: 获取指定键的缓存值 |
||||
|
* 参数: |
||||
|
* key (string, required): 缓存键 |
||||
|
* 权限:AbpCachingManagement.Cache |
||||
|
|
||||
|
* POST `/api/caching-management/cache`: 设置缓存值 |
||||
|
* 参数: |
||||
|
* key (string, required): 缓存键 |
||||
|
* value (string, required): 缓存值 |
||||
|
* absoluteExpiration (DateTime, optional): 绝对过期时间 |
||||
|
* slidingExpiration (DateTime, optional): 滑动过期时间 |
||||
|
* 权限:AbpCachingManagement.Cache.ManageValue |
||||
|
|
||||
|
* PUT `/api/caching-management/cache/refresh`: 刷新缓存 |
||||
|
* 参数: |
||||
|
* key (string, required): 缓存键 |
||||
|
* absoluteExpiration (DateTime, optional): 绝对过期时间 |
||||
|
* slidingExpiration (DateTime, optional): 滑动过期时间 |
||||
|
* 权限:AbpCachingManagement.Cache.Refresh |
||||
|
|
||||
|
* DELETE `/api/caching-management/cache`: 删除缓存 |
||||
|
* 参数: |
||||
|
* key (string, required): 缓存键 |
||||
|
* 权限:AbpCachingManagement.Cache.Delete |
||||
|
|
||||
|
## 安装 |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## 更多 |
||||
|
|
||||
|
有关更多信息,请参阅以下资源: |
||||
|
|
||||
|
* [应用服务实现](../LINGYUN.Abp.CachingManagement.Application/README.md) |
||||
|
* [应用服务契约](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.md) |
||||
|
* [领域层](../LINGYUN.Abp.CachingManagement.Domain/README.md) |
||||
@ -0,0 +1,61 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.StackExchangeRedis |
||||
|
|
||||
|
Cache management implementation module based on StackExchange.Redis. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Implements the `ICacheManager` interface, 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 |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## Configuration and Usage |
||||
|
|
||||
|
1. First, configure the Redis connection string in `appsettings.json`: |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Redis": { |
||||
|
"Configuration": "127.0.0.1:6379" |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Add the following code in the `ConfigureServices` method of your module: |
||||
|
|
||||
|
```csharp |
||||
|
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: |
||||
|
|
||||
|
* [Application Service Implementation](../LINGYUN.Abp.CachingManagement.Application/README.EN.md) |
||||
|
* [Application Service Contracts](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.EN.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.EN.md) |
||||
|
* [Domain Layer](../LINGYUN.Abp.CachingManagement.Domain/README.EN.md) |
||||
@ -0,0 +1,61 @@ |
|||||
|
# LINGYUN.Abp.CachingManagement.StackExchangeRedis |
||||
|
|
||||
|
基于 StackExchange.Redis 的缓存管理实现模块。 |
||||
|
|
||||
|
## 功能 |
||||
|
|
||||
|
* 实现了 `ICacheManager` 接口,提供基于 Redis 的缓存管理功能: |
||||
|
* 获取缓存键列表(支持前缀匹配和过滤) |
||||
|
* 获取缓存值 |
||||
|
* 设置缓存值(支持绝对过期时间和滑动过期时间) |
||||
|
* 刷新缓存 |
||||
|
* 删除缓存 |
||||
|
|
||||
|
## 安装 |
||||
|
|
||||
|
```bash |
||||
|
abp add-module LINGYUN.Abp.CachingManagement |
||||
|
``` |
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
1. 首先需要配置 Redis 连接字符串,在 `appsettings.json` 中添加: |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Redis": { |
||||
|
"Configuration": "127.0.0.1:6379" |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 在模块的 `ConfigureServices` 方法中添加以下代码: |
||||
|
|
||||
|
```csharp |
||||
|
Configure<RedisCacheOptions>(options => |
||||
|
{ |
||||
|
// 可选:配置 Redis 实例名称前缀 |
||||
|
options.InstanceName = "MyApp:"; |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpDistributedCacheOptions>(options => |
||||
|
{ |
||||
|
// 可选:配置缓存键前缀 |
||||
|
options.KeyPrefix = "MyApp:"; |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
## 多租户支持 |
||||
|
|
||||
|
模块内置了多租户支持,会自动根据当前租户ID来隔离缓存数据: |
||||
|
* 有租户时的键格式:`{InstanceName}t:{TenantId}:{KeyPrefix}:{Key}` |
||||
|
* 无租户时的键格式:`{InstanceName}c:{KeyPrefix}:{Key}` |
||||
|
|
||||
|
## 更多 |
||||
|
|
||||
|
有关更多信息,请参阅以下资源: |
||||
|
|
||||
|
* [应用服务实现](../LINGYUN.Abp.CachingManagement.Application/README.md) |
||||
|
* [应用服务契约](../LINGYUN.Abp.CachingManagement.Application.Contracts/README.md) |
||||
|
* [HTTP API](../LINGYUN.Abp.CachingManagement.HttpApi/README.md) |
||||
|
* [领域层](../LINGYUN.Abp.CachingManagement.Domain/README.md) |
||||
Loading…
Reference in new issue