定制 icecave/interlude 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

icecave/interlude

最新稳定版本:0.1.0

Composer 安装命令:

composer require icecave/interlude

包简介

Emulated timeouts for synchronous operations.

README 文档

README

Build Status Test Coverage SemVer

Interlude is a small PHP library for repeating a non-blocking operation until it succeeds, a timeout period is reached, or a maximum number of attempts have been performed.

If you don't need the timeout feature, you might want to try igorw/retry.

Example

use Icecave\Interlude\Exception\AttemptsExhaustedException;
use Icecave\Interlude\Exception\TimeoutException;
use Icecave\Interlude\Invoker;

$invoker = new Invoker;

$operation = function ($remainingTimeout, $remainingAttempts) {
    // do work ...
};

try {
    $invoker->invoke(
        $operation,
        10, // ten second timeout
        3   // maximum of three attempts
    );
} catch (TimeoutException $e) {
    echo 'The operation timed out!' . PHP_EOL;
} catch (AttemptsExhaustedException $e) {
    echo 'The operation was attempted the maximum number of times!' . PHP_EOL;
}

Contact us

统计信息

  • 总下载量: 38.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-08