| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysCache; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.data.redis.connection.RedisServerCommands; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @Api(value = "缓存监控", tags = {"缓存监控管理"}) |
| | | @Tag(name ="缓存监控", description = "缓存监控管理") |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | |
| | | CACHES.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); |
| | | } |
| | | |
| | | @ApiOperation("获取缓存监控详细信息") |
| | | @Operation(summary = "获取缓存监控详细信息") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @GetMapping() |
| | | public R<Map<String, Object>> getInfo() throws Exception { |
| | |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @ApiOperation("获取缓存名称列表") |
| | | @Operation(summary = "获取缓存名称列表") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @GetMapping("/getNames") |
| | | public R<List<SysCache>> cache() { |
| | | return R.ok(CACHES); |
| | | } |
| | | |
| | | @ApiOperation("获取KEYS基于缓存名") |
| | | @Operation(summary = "获取KEYS基于缓存名") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @GetMapping("/getKeys/{cacheName}") |
| | | public R<Set<String>> getCacheKeys(@PathVariable String cacheName) { |
| | |
| | | return R.ok(cacheKyes); |
| | | } |
| | | |
| | | @ApiOperation("获取值基于缓存名与KEY") |
| | | @Operation(summary = "获取值基于缓存名与KEY") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}") |
| | | public R<SysCache> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) { |
| | |
| | | return R.ok(sysCache); |
| | | } |
| | | |
| | | @ApiOperation("清空缓存名") |
| | | @Operation(summary = "清空缓存名") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @DeleteMapping("/clearCacheName/{cacheName}") |
| | | public R<Void> clearCacheName(@PathVariable String cacheName) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("清空缓存KEY") |
| | | @Operation(summary = "清空缓存KEY") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @DeleteMapping("/clearCacheKey/{cacheKey}") |
| | | public R<Void> clearCacheKey(@PathVariable String cacheKey) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("清空所有缓存") |
| | | @Operation(summary = "清空所有缓存") |
| | | @SaCheckPermission("monitor:cache:list") |
| | | @DeleteMapping("/clearCacheAll") |
| | | public R<Void> clearCacheAll() { |