nytris/antilag

维护者

详细信息

github.com/nytris/antilag

源代码

问题

安装: 9

依赖: 0

建议: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:项目

dev-main 2024-09-26 15:04 UTC

This package is auto-updated.

Last update: 2024-09-26 15:04:24 UTC


README

Build Status

当启用 open_basedir 时,在 Nytris 启动初期缓存文件系统命中,在 Nytris Boost 启动之前。

用法

使用 Composer 安装此包

$ composer require nytris/antilag

配置 Nytris 平台

nytris.config.php

<?php

declare(strict_types=1);

use Nytris\Antilag\AntilagPackage;
use Nytris\Antilag\Stage;
use Nytris\Boot\BootConfig;
use Nytris\Boot\PlatformConfig;

$bootConfig = new BootConfig(new PlatformConfig(__DIR__ . '/var/cache/nytris/'));

$bootConfig->installPackage(new AntilagPackage(stage: Stage::STAGE_2));

// (Other Nytris packages, Nytris Boost is recommended...)

$bootConfig->installPackage(new AntilagPackage(stage: Stage::STAGE_3));

return $bootConfig;

尽可能早地调用第一阶段

例如,从一个前端控制器

app.php

<?php

if (getenv('ENABLE_NYTRIS_ANTILAG') !== 'no') {
    require dirname(__DIR__) . '/vendor/nytris/antilag/antilag.php';
    Antilag::stage1();
}

// Using Symfony as an example:
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
// ...

另请参阅