You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.4 KiB

@keyvhq/mongo keyv

MongoDB storage adapter for Keyv.

Uses TTL indexes to automatically remove expired documents. However MongoDB doesn't guarantee data will be deleted immediately upon expiration, so expiry dates are revalidated in Keyv.

Install

npm install --save keyv @keyvhq/mongo

Usage

const Keyv = require('keyv')

const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname')
keyv.on('error', handleConnectionError)

You can specify the collection name, by default 'keyv' is used.

e.g:

const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname', { collection: 'cache' })

License

@keyvhq/mongo © Microlink, Released under the MIT License.
Authored and maintained by Microlink with help from contributors.

microlink.io · GitHub @MicrolinkHQ · Twitter @microlinkhq