1 Star 1 Fork 0

Richard / lock4j

加入 Gitee
与超过 1000 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README.md

lock4j

Distributed lock implementation using Redis and Zookeeper.(基于 Redis 和 Zookeeper 分布式锁实现)

Quick Start

Below is a simple demo. Talk is cheap. Show me the code.

1. Add Dependency

If your're using Maven, just add the following dependency in pom.xml.

<!-- replace here with the latest version -->
<dependency>
    <groupId>com.github.xinlc</groupId>
    <artifactId>lock4j-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

If not, you can download JAR in Maven Center Repository.

2. Define Controller

@DistributedLockable(
        prefix = "hello",
        argNames = {"name"},
        expireTime = 10,
        unit = TimeUnit.SECONDS,
        onFailure = HelloLockException.class
)
@GetMapping
public void hello(@RequestParam("name") String name) {
    log.info("hello {}", name);
}

More examples.

TODO

  • Zookeeper implementation.

简介

Distributed lock implementation using Redis and Zookeeper.(基于 Redis 和 Zookeeper 分布式锁实现) 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/xinlc/lock4j.git
git@gitee.com:xinlc/lock4j.git
xinlc
lock4j
lock4j
master

搜索帮助

E71a60c3 8189591 Df7b7c6b 8189591