with one click
keyvhq
// Build @keyvhq/core key-value caches with TTL, namespaces, memoization, cache-aside patterns, and Redis/Mongo/MySQL/PostgreSQL/SQLite adapters.
// Build @keyvhq/core key-value caches with TTL, namespaces, memoization, cache-aside patterns, and Redis/Mongo/MySQL/PostgreSQL/SQLite adapters.
Automate browserless/Puppeteer headless Chrome for screenshots, PDFs, HTML/text extraction, status checks, Lighthouse audits, and browser pipelines.
Create project-local skills for Cursor and Claude Code when users ask to create, add, or update reusable repo instructions.
Retrieve normalized HTML from URLs with fetch or headless prerender for JS pages, absolute URL rewriting, and metadata extraction pipelines.
Tune Kubernetes HPA, topology spread, requests, and scale-down behavior for cluster cost audits, incidents, replica/node issues, and over-reservation.
Extract metadata from HTML with metascraper rules for link previews, Open Graph, Twitter Cards, JSON-LD, titles, images, authors, and custom parsers.
Use Microlink API/MQL to extract URL metadata, build link previews, capture screenshots/PDFs, scrape CSS-selected data, and avoid browser infrastructure.
| name | keyvhq |
| description | Build @keyvhq/core key-value caches with TTL, namespaces, memoization, cache-aside patterns, and Redis/Mongo/MySQL/PostgreSQL/SQLite adapters. |
keyvhq provides @keyvhq/core plus adapters and decorators for building a simple key-value cache with optional persistence.
Install core:
npm install @keyvhq/core
Use in-memory storage:
const Keyv = require('@keyvhq/core')
const cache = new Keyv()
await cache.set('greeting', 'hello', 1000)
const value = await cache.get('greeting')
Use a Redis adapter:
npm install @keyvhq/core @keyvhq/redis
const Keyv = require('@keyvhq/core')
const KeyvRedis = require('@keyvhq/redis')
const cache = new Keyv({
store: new KeyvRedis('redis://user:pass@localhost:6379'),
namespace: 'app-cache'
})
@keyvhq/core in memory for local development.namespace per module to avoid collisions and accidental global clears.ttl option) or per set.new Keyv(options): create instance.set(key, value, ttl?): store value, optional TTL in milliseconds.get(key): read value.has(key): check existence.delete(key): remove one key.clear(): remove all keys in the current namespace.iterator(): async iterate entries (avoid for large datasets).store: adapter instance (default is in-memory Map).namespace: key namespace to isolate data.ttl: default TTL in milliseconds.serialize / deserialize: custom serialization for advanced types.raw: return internal stored object including expiry metadata.Choose an official adapter based on runtime and infrastructure:
@keyvhq/redis: low-latency shared cache, easy horizontal scaling.@keyvhq/mongo: Mongo-backed cache persistence.@keyvhq/mysql: MySQL or MariaDB-backed storage.@keyvhq/postgres: PostgreSQL-backed storage.@keyvhq/sqlite: file-based local persistence.@keyvhq/file: lightweight JSON/file storage.keyv-s3: S3 object storage adapter for large, low-cost cache persistence.Use one connector at a time as store:
@keyvhq/redis)npm install @keyvhq/core @keyvhq/redis
const Keyv = require('@keyvhq/core')
const KeyvRedis = require('@keyvhq/redis')
const cache = new Keyv({
store: new KeyvRedis('redis://user:pass@localhost:6379'),
namespace: 'app-cache'
})
@keyvhq/mongo)npm install @keyvhq/core @keyvhq/mongo
const Keyv = require('@keyvhq/core')
const KeyvMongo = require('@keyvhq/mongo')
const cache = new Keyv({
store: new KeyvMongo('mongodb://user:pass@localhost:27017/dbname'),
namespace: 'app-cache'
})
@keyvhq/mysql)npm install @keyvhq/core @keyvhq/mysql
const Keyv = require('@keyvhq/core')
const KeyvMySQL = require('@keyvhq/mysql')
const cache = new Keyv({
store: new KeyvMySQL('mysql://user:pass@localhost:3306/dbname'),
namespace: 'app-cache'
})
@keyvhq/postgres)npm install @keyvhq/core @keyvhq/postgres
const Keyv = require('@keyvhq/core')
const KeyvPostgres = require('@keyvhq/postgres')
const cache = new Keyv({
store: new KeyvPostgres('postgresql://user:pass@localhost:5432/dbname'),
namespace: 'app-cache'
})
@keyvhq/sqlite)npm install @keyvhq/core @keyvhq/sqlite
const Keyv = require('@keyvhq/core')
const KeyvSQLite = require('@keyvhq/sqlite')
const cache = new Keyv({
store: new KeyvSQLite('sqlite://path/to/database.sqlite'),
namespace: 'app-cache'
})
@keyvhq/file)npm install @keyvhq/core @keyvhq/file
const Keyv = require('@keyvhq/core')
const KeyvFile = require('@keyvhq/file')
const cache = new Keyv({
store: new KeyvFile({ filename: './.cache/keyv.json' }),
namespace: 'app-cache'
})
keyv-s3)npm install @keyvhq/core keyv-s3 @aws-sdk/client-s3
const Keyv = require('@keyvhq/core')
const KeyvS3 = require('keyv-s3')
const cache = new Keyv({
store: new KeyvS3({
region: 'us-east-1',
namespace: 'app-cache',
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
})
})
Use decorators for specialized behavior:
@keyvhq/compress: compress stored payloads.@keyvhq/memoize: memoize function calls through Keyv.@keyvhq/multi: combine local and remote stores.@keyvhq/offline: add offline-aware behavior.@keyvhq/stats: collect usage metrics over time.When adding cache support to a module:
cache option in module configuration.namespace before calling clear().function createClient({ cache = new Keyv({ namespace: 'my-module' }) } = {}) {
return {
async getOrFetch(key, fetcher, ttl) {
const cached = await cache.get(key)
if (cached !== undefined) return cached
const value = await fetcher()
await cache.set(key, value, ttl)
return value
}
}
}
clear() without a namespace can wipe all entries in that store.iterator().https://github.com/microlinkhq/keyvhqhttps://github.com/microlinkhq/keyvhq/blob/master/README.md/Users/kikobeats/Projects/microlink/keyv-s3