Class RedisIdGeneratorService
java.lang.Object
icu.congee.id.generator.service.impl.RedisIdGeneratorService
- All Implemented Interfaces:
IdGeneratorService
基于Redisson分布式锁的ID生成器实现类
提供通过Redis分布式锁实现的线程安全ID生成服务
- Since:
- 1.0.0
- Author:
- congee
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
RedisIdGeneratorService
public RedisIdGeneratorService()
-
-
Method Details
-
generate
Description copied from interface:IdGeneratorService生成单个分布式ID- Specified by:
generatein interfaceIdGeneratorService- Parameters:
idType- ID类型枚举- Returns:
- 生成的分布式ID对象
- Throws:
InterruptedException- 当获取分布式锁时被中断抛出
-
generate
Description copied from interface:IdGeneratorService批量生成分布式ID- Specified by:
generatein interfaceIdGeneratorService- Parameters:
idType- ID类型枚举count- 需要生成的ID数量- Returns:
- 包含生成ID的数组
- Throws:
InterruptedException- 当获取分布式锁时被中断抛出
-