|
|
|
@ -8,12 +8,19 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.Cursor; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.RedisCallback; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.ScanOptions; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author ypj |
|
|
|
* @author ypj |
|
|
|
@ -68,4 +75,19 @@ public class TestController { |
|
|
|
sideHustleService.loadDutyInfo(null); |
|
|
|
sideHustleService.loadDutyInfo(null); |
|
|
|
return R.success("运行成功"); |
|
|
|
return R.success("运行成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/cleanUserCache") |
|
|
|
|
|
|
|
@ApiOperation(value = "清空指定租户的用户缓存(blade UserCache,{tenantId}:user*)") |
|
|
|
|
|
|
|
R<Boolean> cleanUserCache(@RequestParam String tenantId) { |
|
|
|
|
|
|
|
List<String> keys = new ArrayList<>(); |
|
|
|
|
|
|
|
redisTemplate.execute((RedisCallback<Object>) connection -> { |
|
|
|
|
|
|
|
Cursor<byte[]> cursor = connection.scan(ScanOptions.scanOptions().match(tenantId + ":user*").count(100).build()); |
|
|
|
|
|
|
|
while (cursor.hasNext()) { |
|
|
|
|
|
|
|
keys.add(new String(cursor.next(), StandardCharsets.UTF_8)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
keys.forEach(redisTemplate::delete); |
|
|
|
|
|
|
|
return R.success("清空完成,共删除" + keys.size() + "个key"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|