schmunk42/retry

A tiny library for retrying failing operations. [fork with tags]

Maintainers

Details

github.com/schmunk42/retry

Source

Installs: 520 181

Dependents: 2

Suggesters: 0

Security: 0

Stars: 4

Watchers: 3

Forks: 29

0.0.1 2014-09-20 11:10 UTC

This package is auto-updated.

Last update: 2024-12-13 01:16:43 UTC


README

A tiny library for retrying failing operations.

Since the network is reliable, things should always work. Am I right? For those cases when they don't, there is retry.

<?
use function igorw\retry;

// retry an operation up to 5 times
$user = retry(5, function () use ($id) {
    return User::find($id);
});

// here is why you want to start using HHVM
$user = retry(5, () ==> User::find($id));

// this is probably a bad idea
$user = retry(INF, () ==> {
    throw new RuntimeException('never gonna give you up');
});
?>

I know. You're welcome.