Adds compression bindings for your Keyv instance.
$ npm install @keyvhq/compress --save
All you need to do is to wrap your keyv instance:
const KeyvRedis = require('@keyvhq/redis')
const Keyv = require('@keyvhq/core')
const store = new KeyvRedis({
uri: 'redis://user:pass@localhost:6379',
maxRetriesPerRequest: 1,
emitErrors: false
})
const keyv = new Keyv({ store })
Using @keyvhq/compress
at the top level:
const KeyvCompress = require('@keyvhq/compress')
const keyv = KeyvCompress(new Keyv({ store }))
Additionally, it can accept compress-brotli#options as second argument:
const keyv = KeyvCompress(
new Keyv({ store }),
{
serialize: v8.serialize,
deserialize: v8.deserialize
}
)
@keyvhq/memoize © Kiko Beats, released under the MIT License.
Maintained by Microlink with help from contributors.
microlink.io · GitHub microlinkhq · X @microlinkhq