Package Exports
- @keyvhq/offline
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@keyvhq/offline) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@keyvhq/offline 
Adds offline capabilities for your keyv instance.
Install
$ npm install @keyvhq/offline --saveUsage
All you need to do is to wrap your keyv instance:
const KeyvRedis = require('@keyvhq/redis')
const keyv = new KeyvRedis({
uri: 'redis://user:pass@localhost:6379',
maxRetriesPerRequest: 1,
emitErrors: false
})Using @keyvhq/offline at the top level:
const KeyvRedis = require('@keyvhq/redis')
const keyvOffline = require('@keyvhq/offline')
const keyv = keyvOffline(new KeyvRedis({
uri: 'redis://user:pass@localhost:6379',
maxRetriesPerRequest: 1,
emitErrors: false
}))That's all!
In the next database downtime, your keyv set/get petitions will be temporarily bypassed, preventing your application to crash for that, being more resilient than the default keyv behavior.
As soon as the connection is re-established it will be work back as expected.
In case you need, you can see omitted errors enabling debug doing DEBUG=@keyvhq/offline*
License
@keyvhq/memoize © Kiko Beats, Released under the MIT License.
Maintained by Microlink with help from contributors.
microlink.io · GitHub @MicrolinkHQ · Twitter @microlinkhq