DouZi

All Distributed lock

License

License

GroupId

GroupId

com.github.sunjinyue1993
ArtifactId

ArtifactId

douzi
Last Version

Last Version

1.0.1.RELEASE
Release Date

Release Date

Type

Type

pom
Description

Description

DouZi
All Distributed lock
Project URL

Project URL

https://github.com/SunJinYue1993/douzi
Source Code Management

Source Code Management

https://github.com/SunJinYue1993/douzi.git

Download douzi

Filename Size
douzi-1.0.1.RELEASE.pom 8 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.sunjinyue1993/douzi/ -->
<dependency>
    <groupId>com.github.sunjinyue1993</groupId>
    <artifactId>douzi</artifactId>
    <version>1.0.1.RELEASE</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.sunjinyue1993/douzi/
implementation 'com.github.sunjinyue1993:douzi:1.0.1.RELEASE'
// https://jarcasting.com/artifacts/com.github.sunjinyue1993/douzi/
implementation ("com.github.sunjinyue1993:douzi:1.0.1.RELEASE")
'com.github.sunjinyue1993:douzi:pom:1.0.1.RELEASE'
<dependency org="com.github.sunjinyue1993" name="douzi" rev="1.0.1.RELEASE">
  <artifact name="douzi" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.sunjinyue1993', module='douzi', version='1.0.1.RELEASE')
)
libraryDependencies += "com.github.sunjinyue1993" % "douzi" % "1.0.1.RELEASE"
[com.github.sunjinyue1993/douzi "1.0.1.RELEASE"]

Dependencies

compile (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.26

Project Modules

  • douzi-spring-boot-starter
  • douzi-common

使用手册

1. 添加依赖

<dependency>
    <groupId>com.github.sunjinyue1993</groupId>
    <artifactId>douzi-spring-boot-starter</artifactId>
    <version>1.0.1.RELEASE</version>
</dependency>
  • 基于MySQL
- 创建表
create table tbl_mysql_lock
(
    lock_id     int null,
    lock_status int null
);
create index tbl_mysql_lock_lock_id_index on tbl_mysql_lock (lock_id);
- 在需要同步的方法上添加@MysqlLock注解,默认模式
@MysqlLock
public String syncMethod() {
    // 抢单。。。。
}
  • 基于单机Redis
- 配置RedisLock
@Configuration
public class LockConfig {
    @Bean
    public Lock lock() {
        return new RedisLock();
    }
}
- 在需要同步的方法上添加@RedisLock注解
@RedisLock
public String syncMethod() {
    // 抢单。。。。
}

Versions

Version
1.0.1.RELEASE
1.0.0