anper / predis-command-collector

此包已弃用且不再维护。未建议替代包。

PHP Predis 命令收集器。

v0.4.0 2021-01-07 14:36 UTC

This package is auto-updated.

Last update: 2022-06-16 09:55:20 UTC


README

Software License Latest Version on Packagist Build Status

安装

$ composer require anper/predis-command-collector

收集器用法

use Anper\Predis\CommandCollector\Collector;
use function Anper\Predis\CommandCollector\register_collector;

$client = new \Predis\Client(...);

register_collector($client, $collector = new Collector($client));

// redis queries...

foreach($collector->getProfiles() as $profile) {
    echo $profile->getCommandAsString();
}

函数用法

use Anper\Predis\CommandCollector\Profile;

use function Anper\Predis\CommandCollector\register_collector;

$collector = function (Profile $profile) {
    echo $profile->getCommandAsString();
};

register_collector($client, $collector);

测试

$ composer test

贡献

有关详细信息,请参阅CONTRIBUTING

许可

MIT 许可证 (MIT)。有关更多信息,请参阅许可文件