Redis Lock

Redis 分布式锁

License

License

Categories

Categories

Redis Data Databases
GroupId

GroupId

io.github.spring-tools
ArtifactId

ArtifactId

redis-lock
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Redis Lock
Redis 分布式锁

Download redis-lock

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.spring-tools/redis-lock/ -->
<dependency>
    <groupId>io.github.spring-tools</groupId>
    <artifactId>redis-lock</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.spring-tools/redis-lock/
implementation 'io.github.spring-tools:redis-lock:1.1.0'
// https://jarcasting.com/artifacts/io.github.spring-tools/redis-lock/
implementation ("io.github.spring-tools:redis-lock:1.1.0")
'io.github.spring-tools:redis-lock:jar:1.1.0'
<dependency org="io.github.spring-tools" name="redis-lock" rev="1.1.0">
  <artifact name="redis-lock" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.spring-tools', module='redis-lock', version='1.1.0')
)
libraryDependencies += "io.github.spring-tools" % "redis-lock" % "1.1.0"
[io.github.spring-tools/redis-lock "1.1.0"]

Dependencies

compile (5)

Group / Artifact Type Version
io.github.spring-tools : redis-core jar 1.1.0
org.springframework : spring-aspects jar
org.projectlombok : lombok Optional jar 1.18.10
org.springframework : spring-context jar
org.slf4j : slf4j-api Optional jar

test (4)

Group / Artifact Type Version
com.google.guava : guava jar 28.2-jre
junit : junit jar
org.springframework.boot : spring-boot-starter-test jar
org.springframework.boot : spring-boot-starter-data-redis jar

Project Modules

There are no modules declared in this project.

redis-tools

介绍

基于 Spring 实现的 Redis 工具包,暂时支持:

Lock

Redis 的 分布式锁,支持特性:

  1. 重入
  2. 降级
  3. 回滚
  4. 自旋
  5. 支持 enable 引用 和 starter 的开箱即用方式。

具体介绍Redis-Lock

当前最新版本 lastVersion = 1.1.0

1、MAVEN 引用

<dependency>
   <groupId>io.github.spring-tools</groupId>
   <artifactId>redis-lock-spring-boot-starter</artifactId>
   <version>${lastVersion}</version>
</dependency>

2. try/finally 使用

    // 来一个 try-with-resource 模式
    IRedisLock lock = RedisLockBuilder.builder(LOCK_KEY).build();
    try{
        Assert.assertTrue(lock.tryLock());
    }finally{
        lock.unlock();
    }

版本更新

  • 1.0.0 发布 (2020-02-24)

完成了基本框架和分布式锁实现。

Versions

Version
1.1.0
1.0.0