1
0
mirror of synced 2026-04-18 22:38:41 +08:00

code_editreadme

This commit is contained in:
zhouzj
2021-03-13 00:01:03 +08:00
parent 761020f3eb
commit 624782c2ca
5 changed files with 22 additions and 11 deletions

View File

@@ -115,7 +115,7 @@
5.订阅ID异步通知。IIdGenerator.GenIdActionAsync 是一个可以向外部系统异步发送ID生成消息的事件它包含的消息类型有"漂移开始、漂移结束、时间回拨",具体参考 Yitter.IdGenTest 的 Program.cs 启动代码。不过订阅ID异步通知会有细微的性能损失。
6.步或同步调用。你可在外部系统的异步async标记方法中调用本算法同步调用同样没问题。
6.步或同步调用。你可在外部系统的异步async标记方法中调用本算法同步调用同样没问题。
7.使用雪花漂移算法。虽然代码里包含了传统雪花算法的定义并且你可以在入口处指定Method=2来启用传统算法但仍建议你使用雪花漂移算法Method=1默认的毕竟它具有更好的伸缩力和更高的性能。
@@ -157,11 +157,10 @@
1..NET Standard 2.0+
#### 文件说明
1.SnowWorkerM1.cs 是雪花漂移算法。
2.SnowWorkerM2.cs 是传统雪花算法。
#### 引用nuget包
```
<PackageReference Include="Yitter.IdGenerator" Version="1.0.2" />
```
#### 调用示例
```
@@ -172,7 +171,6 @@ IdHelper.SetIdGenerator(options);
// 初始化以后就可以在需要的地方调用方法生成ID。
var newId = IdHelper.NextId();
// 可通过 IdHelper.IdGenInstance 订阅 GenIdActionAsync 事件。
```
如果基于DI框架集成可以参考 IdHelper 去管理 IdGenerator 对象,必须使用**单例**模式。

View File

@@ -43,14 +43,14 @@ namespace Yitter.OrgSystem.TestA
Method = method,
WorkerId = 1,
TopOverCostCount = 2000,
WorkerIdBitLength = 10,
SeqBitLength = 6,
//TopOverCostCount = 2000,
//WorkerIdBitLength = 6,
//SeqBitLength = 9,
//MinSeqNumber = 11,
//MaxSeqNumber = 200,
StartTime = DateTime.Now.AddYears(-5),
StartTime = DateTime.Now.AddYears(-10),
};
// ++++++++++++++++++++++++++++++++

View File

@@ -6,6 +6,19 @@
<PropertyGroup>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Shorter ID and faster generation with a new snowflake drift algorithm. The core is to shorten the ID length, but also can have a very high instantaneous concurrent processing capacity (50W/0.1s), and powerful configuration capacity.
一种全新的雪花漂移算法让ID更短、生成速度更快。 核心在于缩短ID长度的同时还能拥有极高瞬时并发处理量50W/0.1s),及强大的配置能力。</Description>
<AssemblyName>Yitter.IdGenerator</AssemblyName>
<RootNamespace>Yitter.IdGenerator</RootNamespace>
<Product>IdGenerator</Product>
<Company>Yitter</Company>
<Authors>Yitter</Authors>
<Copyright>Yitter</Copyright>
<PackageProjectUrl>https://gitee.com/yitter/idgenerator</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB