Documentation

id
in package

生成唯一ID

Table of Contents

Properties

$config  : mixed
$snowflake_obj  : mixed

Methods

create()  : mixed
使用Sonyflake生成唯一值,确保并发时生成唯一ID,最长可用174年 $id = \thefunpower\sonyflake\id::create(); 如果需要不同的sequence,可传值\thefunpower\sonyflake\id::create($center_id=0,$work_id=1); https://github.com/godruoyi/php-snowflake
set()  : mixed
设置配置 $config['redis'] = [ 'host'=>'', 'port'=>'', 'auth'=>'', ];

Properties

$config

public static mixed $config

$snowflake_obj

public static mixed $snowflake_obj

Methods

create()

使用Sonyflake生成唯一值,确保并发时生成唯一ID,最长可用174年 $id = \thefunpower\sonyflake\id::create(); 如果需要不同的sequence,可传值\thefunpower\sonyflake\id::create($center_id=0,$work_id=1); https://github.com/godruoyi/php-snowflake

public static create([mixed $center_id = 0 ][, mixed $work_id = 0 ]) : mixed
Parameters
$center_id : mixed = 0
$work_id : mixed = 0

set()

设置配置 $config['redis'] = [ 'host'=>'', 'port'=>'', 'auth'=>'', ];

public static set(mixed $config) : mixed

$config['sony_flake'] = [ 'from_date'=>'2022-10-27', ];

Parameters
$config : mixed

        
On this page

Search results