Skip to content

Commit

Permalink
2024-12-07 06:12:04
Browse files Browse the repository at this point in the history
  • Loading branch information
yingzhuo committed Dec 6, 2024
1 parent 5dfc689 commit e6b02f9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* 防重复调用
*
* @author 应卓
* @see AvoidRepeatedInvocationAdvice
* @since 3.4.0
*/
@Inherited
Expand All @@ -27,7 +28,7 @@
*
* @return 自动释放时间
*/
public long leaseTime() default 3L;
public long leaseTime() default 5L;

/**
* 锁自动释放时间单位
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

/**
* @author 应卓
* @see AvoidRepeatedInvocation
* @since 3.4.0
*/
@Aspect
Expand Down Expand Up @@ -55,7 +56,7 @@ public Object around(ProceedingJoinPoint joinPoint) throws Throwable {

var redisKey = (String) SpEL.getValue(
annotation.value(),
null,
(Object) null,
Map.of(
"args", joinPoint.getArgs(),
"method", method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ public class DistributedBloomFilter implements BloomFilter {
private final String redisKey;
private final int bitmapSize;

/**
* 构造方法
*
* @param redisOperations RedisOperations实例,通常是 {@link StringRedisTemplate}
* @param redisKey redis的键
*/
public DistributedBloomFilter(RedisOperations<String, String> redisOperations, String redisKey) {
this(redisOperations, redisKey, DEFAULT_BITMAP_SIZE);
}

/**
* 构造方法
*
* @param redisOperations RedisOperations实例,通常是 {@link StringRedisTemplate}
* @param redisKey redis的键
* @param bitmapSize 底层bitmap长度
*/
public DistributedBloomFilter(RedisOperations<String, String> redisOperations, String redisKey, int bitmapSize) {
Assert.notNull(redisOperations, "redisOperations is null");
Assert.hasText(redisKey, "redisKey is null or empty");
Assert.isTrue(bitmapSize >= 1000_0000, "bitmapSize should >= 10000000");

this.redisOperations = redisOperations;
this.redisKey = redisKey;
this.bitmapSize = bitmapSize;
}

/**
* 创建默认配置的布隆过滤器 <br>
* <ul>
Expand Down Expand Up @@ -58,33 +85,6 @@ public static DistributedBloomFilter createDefault(
);
}

/**
* 构造方法
*
* @param redisOperations RedisOperations实例,通常是 {@link StringRedisTemplate}
* @param redisKey redis的键
*/
public DistributedBloomFilter(RedisOperations<String, String> redisOperations, String redisKey) {
this(redisOperations, redisKey, DEFAULT_BITMAP_SIZE);
}

/**
* 构造方法
*
* @param redisOperations RedisOperations实例,通常是 {@link StringRedisTemplate}
* @param redisKey redis的键
* @param bitmapSize 底层bitmap长度
*/
public DistributedBloomFilter(RedisOperations<String, String> redisOperations, String redisKey, int bitmapSize) {
Assert.notNull(redisOperations, "redisOperations is null");
Assert.hasText(redisKey, "redisKey is null or empty");
Assert.isTrue(bitmapSize >= 1000_0000, "bitmapSize should >= 10000000");

this.redisOperations = redisOperations;
this.redisKey = redisKey;
this.bitmapSize = bitmapSize;
}

/**
* 获取底层bitmap长度
*
Expand Down

0 comments on commit e6b02f9

Please sign in to comment.