@Component
public class RedisSequence {
@Autowired
private RedisTemplate<String, Serializable> redisTemplate;
public long generate(String key) {
RedisAtomicLong redisAtomicLong = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
return redisAtomicLong.incrementAndGet();
}
}