通过redis实现,一秒内同一个用户,限制请求一次
// 限流逻辑String rateLimitKey = RATE_LIMIT_KEY_PREFIX + userImageUrl;Boolean isLimited = stringRedisTemplate.opsForValue().setIfAbsent(rateLimitKey, "1", 1, TimeUnit.SECONDS);if (isLimited == null || !isLimited) {logger.warn("User {} is submitting too frequently. Request rejected.", userImageUrl);throw new RuntimeException("You can only submit once every second.");}