Configuration

The published configuration file is located at config/cadence.php.

return [

    'default' => env('CADENCE_DEFAULT_DRIVER', 'exponential'),

    'free_attempts' => 3,

    'idle_timeout' => 3600,

    'cache' => [
        'store' => env('CADENCE_CACHE_STORE'),
    ],

    'drivers' => [

        'exponential' => [
            'base_delay' => 2,
        ],

        'fibonacci' => [
            'base_delay' => 1,
        ],

        'linear' => [
            'base_delay' => 2,
        ],

        'quadratic' => [
            'base_delay' => 1,
        ],

    ],

];

Configuration Options

OptionDefaultDescription
defaultexponentialThe default backoff driver.
free_attempts3Number of failures allowed before backoff is applied.
idle_timeout3600Number of seconds to retain failure state before it expires.
cache.storenullLaravel cache store name used by Cadence. Leave null to use the default store.
drivers.exponential.base_delay2Base delay used by the exponential driver.
drivers.fibonacci.base_delay1Base delay used by the fibonacci driver.
drivers.linear.base_delay2Base delay used by the linear driver.
drivers.quadratic.base_delay1Base delay used by the quadratic driver.

Using a Specific Backoff Strategy

Cadence supports multiple backoff strategies. You can configure the default strategy using the CADENCE_DEFAULT_DRIVER environment variable.

CADENCE_DEFAULT_DRIVER=fibonacci

See the Available Backoff Strategies section for the list of built-in drivers and their behavior.

If not specified, Cadence uses the exponential strategy by default.

Using a Specific Laravel Cache Store

Cadence uses Laravel's cache abstraction, so it can work with any cache store supported by your Laravel application.

Set the store with an environment variable:

CADENCE_CACHE_STORE=

Examples:

CADENCE_CACHE_STORE=redis
CADENCE_CACHE_STORE=database

If the value is empty or not set, Cadence falls back to Laravel's default cache store.