mysql-kv is a Node.js package that implements a key-value store with TTL expiration on top of MySQL. Version 1.7.3 is current, with no major version changes since initial release. It uses a hardcoded table schema and the mysql2 driver for connection pooling. Key differentiators: simple API (get/set/delete/cleanup), automatic expiration cleanup, and support for custom SQL queries. Not suitable for high-throughput or production without careful MySQL schema management.
npm install mysql-kvNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a KV instance, set/get/delete a key with TTL, cleanup expired entries, and retrieve all entries.
Run the CREATE TABLE script from the documentation before using the package.
Always specify the `database` property in the config object.
Use `LONGBLOB` or alter the table schema if storing binary data or large payloads.
Always pass criteria as an array and avoid string concatenation in the query.
Add `database: 'your_db_name'` to the KV constructor config.
Execute the CREATE TABLE statement from the package documentation.
Use `const { KV } = require('mysql-kv')` or `import { KV } from 'mysql-kv'`.