soldevelop / multithread
MultiThread 是一个库,允许多个进程写入一个 sqlite 数据库,这个库对于不想购买 MySQL 数据库的开发者非常有用。
dev-main
2021-10-10 10:52 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2024-09-10 17:25:36 UTC
README
MultiThread 是一个 PHP 库,允许开发者向 SQLite 数据库发送多个请求,这意味着现在你可以使用 SQLite 来做更多的事情。
它如何工作
使用核心 PHP 魔法
对于非 COMPOSER 版本,请使用以下内容:
include 'autoload.php';
示例?
在数据库上启用 MultiThread
require 'vendor/autoload.php'; // Enabling MultiThread By Putting The Database File Path and the Query String And Disabling the Request by setting it to false and Enabling MultiThread on The Database By Setting It To true and choosing the limit which is by default is 3 (3 means only 3 request will made) $start = new MultiThread("database path", "The Query String Here", false, true, 3);
使用 MultiThread
require 'vendor/autoload.php'; // Make New MultiThread Object and Setting The Request Boolean to true $call = new MultiThread("database path", "The Query String Here", true); $waitingnumber = $call->call("database path", "The Query String Here"); // sleep for 5 seconds or more depending on how busy is your website to wait for 3 (or the limit you made) requests sleep(5); // Get The Query Output (in a array) $output = file_get_contents("path/to/src/ids/shared-" . $waitingnumber . ".json"); while ($row = $output){ // do stuff }
由 SolDeveloper 制作。
希望这个库能帮助到某个人。