keyv-mysql-shrink
Fork of the MySQL/MariaDB storage adapter for Keyv. Supports removing expired data via a shrink
function.
Install
npm install --save keyv keyv-mysql-shrink
Usage
const Keyv = require('keyv');
const KeyvStorageAdapter = require('keyv-mysql-shrink');
const storage = new KeyvStorageAdapter({
uri: 'mysql://user:pass@localhost:3306/dbname',
table: 'myappcache',
keySize: 255 // this is the default
});
const keyv = new Keyv({
store: storage,
namespace: 'myapp'
});
keyv.on('error', handleConnectionError);
Note: Some MySQL/MariaDB installations won't allow a key size longer than 767 bytes. If you get an error on table creation try reducing keySize
to 191 or lower. #5
License
MIT © MySidesTheyAreGone
MIT © Luke Childs