fishingboy/external_sort
Composer 安装命令:
composer require fishingboy/external_sort
包简介
external sort PHP library
README 文档
README
繁體中文 | English
A PHP library for external merge sort — designed for datasets too large to sort in memory.
You can set a block_size limit: data within the limit is sorted in memory, while larger datasets are split into sorted temporary files and merged via a k-way merge.
Available on Packagist for installation via Composer.
Installation
composer require fishingboy/external_sort
Or add it manually to composer.json:
{
"require": {
"fishingboy/external_sort": "dev-master"
}
}
Usage
use fishingboy\external_sort\External_sort; $sorter = new External_sort([ 'block_size' => 1000, // max rows buffered in memory before flushing to a temp file 'result_file' => 'out.txt', // output path for the final sorted result 'data_type' => 'number', // 'number' (int cast) or 'text' (string trim) ]); $sorter->add_data($value); // accepts a single value or an array; call repeatedly $sorter->create_result(); // performs k-way merge and writes to result_file
License
This project is licensed under the MIT License.
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-05