Distributed ID generation method and device based on Redis and medium
The invention discloses a distributed ID generation method and device based on Redis and a medium, belongs to the technical field of distributed ID generation, and aims to solve the technical problem of how to quickly and stably generate a distributed ID without depending on a database and realize a...
Gespeichert in:
1. Verfasser: | |
---|---|
Format: | Patent |
Sprache: | chi ; eng |
Schlagworte: | |
Online-Zugang: | Volltext bestellen |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | The invention discloses a distributed ID generation method and device based on Redis and a medium, belongs to the technical field of distributed ID generation, and aims to solve the technical problem of how to quickly and stably generate a distributed ID without depending on a database and realize automatic and flexible configuration of a work ID. Comprising the following steps: when an application node is started regularly, executing a workID allocation step to allocate a workID to the application node; if the application node is allocated with the workID, judging whether the value stored in the Redis is consistent with the value of the application node, if so, selectively updating the expiration time of the application node as required, and if not, executing the workID allocation step to re-allocate the workID to the application node; and for the application nodes exceeding the expiration time, releasing and recycling the workIDs of the application nodes, regenerating an idle list and storing the idle list |
---|