yiranzai/hash-dht
Composer 安装命令:
composer require yiranzai/hash-dht
包简介
PHP Distributed Hash Table
关键字:
README 文档
README
PHP Distributed Hash Table, Suitable for assisting in finding distributed nodes corresponding to key.
Install
Via Composer
$ composer require yiranzai/hash-dht
Usage
easy
init
$hash = new Yiranzai\Dht\Hash(); $hash->addEntityNode('db_server_one')->addEntityNode('db_server_two'); $dbServer = $hash->getLocation('key_one');
Reuse it
You have to cache it and pass it in the next time you use it.
Or use the static::cache I provided.
$hash = new Yiranzai\Dht\Hash(); $hash->addEntityNode('db_server_one')->addEntityNode('db_server_two'); $dbServer = $hash->getLocation('key_one'); Yiranzai\Dht\Hash::cache($hash->toArray()); $hash = new Yiranzai\Dht\Hash(Yiranzai\Dht\Hash::getCache()); $dbServer = $hash->getLocation('key_one');
Delete Entity Node
Delete entity node
$hash = new Yiranzai\Dht\Hash(); $hash->deleteEntityNode('db_server_one');
Change algo
default algo is time33, See more support
$hash = new Yiranzai\Dht\Hash(); $hash->algo('sha256'); //or $hash = new Yiranzai\Dht\Hash(['algo' => YOUR_ALGO]);
Change default cache path
Change default cache path
$hash = new Yiranzai\Dht\Hash(); $hash->path(YOUR_PATH); //or $hash = new Yiranzai\Dht\Hash(['cachePath' => YOUR_PATH]);
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email wuqingdzx@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-07