Giter VIP home page Giter VIP logo

kkb-uid-generator's Introduction

uid generator

RingBuffer

单线程阻塞写入

配置使用

@SpringBootApplication
@EnableUidGenerator
public class UidApplication {
    public static void main(String[] args) {
        SpringApplication.run(UidApplication.class, args);
    }
}
server:
  port: 9999
spring:
  application:
    name: uid-generator-app
  profiles:
    active: test
kkb:
  plugins:
    uid-generator:
      dataSource:
        driver: com.mysql.jdbc.Driver
        url: jdbc:mysql://localhost:3306/test
        username: root
        password: 123456
      snowflake:
        useCache: false # 是否使用缓存
        epoch: 2021-11-11 # 初始时间 yyyy-MM-dd
        timeBits: 28 # 28 位 时间戳 - 可用 8.5 年左右
        workerBits: 22 # 22 位 workerId,最大 1 << 22 = 4194304
        seqBits: 13 # 13 位 序列号,最大 1 << 13 = 8192
        boostPower: 3 # 设置缓存大小(大小为 (maxSequence + 1) << boostPower)
        useCycleWorkerId: true # workerId 基于数据库 id,使用 & 运算计算 id;测试环境开启,线上环境关闭
        scheduleInterval: 300 # 填充缓存线程定时调度执行周期,300 秒 一次

---
spring:
  profiles: test

---
spring:
  profiles: prod
kkb:
  plugins:
    uid-generator:
      snowflake:
        useCycleWorkerId: false

kkb-uid-generator's People

Contributors

dc-joney avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.