tractr / catbox-fallback

Catbox engine allowing you to use two engines, a primary and a secondary, and if the primary is down, the secondary takes over.
MIT License
11 stars 0 forks source link

Catbox Fallback

Catbox engine allowing you to use two engines, a primary and a secondary, and if the primary is down, the secondary takes over. After that, if the primary becomes ready it's gonna be used.

Lead maintainer: Simon Lévesque and Edouard Demotes-Mainard

Current version: Current Version

Options

Examples

Basic usage, Redis with Memory as fallback.

const server = Hapi.server({
    port: 3000,
    host: 'localhost',
    cache: {
        name: 'fallback',
        provider: {
            constructor: require('catbox-fallback'),
            options: {
                primary: {
                    engine: require('catbox-redis'),
                    options: {
                        partition: 'example',
                        host: '127.0.0.1',
                        port: 6379
                    },
                    timeout: 5000,
                    recoveryDelay: 30000
                },
                secondary: {
                    engine: require('catbox-memory')
                }
            }
        }
    }
});

For more details, see examples.