cache-manager memory store wrap and mset: working versions (tested 2026-10-15)
Create a cache-manager cache backed by Keyv Map storage, wrap loaders, and multi-set values offline.
passed2 passed · 0 failed2026-10-15 20:56 UTC- Status
- passed
- Last passed
- 2026-10-15 20:56 UTC
- Tests
- 2 / 2
- Language
- TypeScript
- Runtime
- node v22.23.3
pinned versions4
cache-manager@7.2.9keyv@6.1.0@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false npm test
test environment
node v22.23.3 linux 6.17.0-1022-azure x64 runner: github-actions 38805962781
The code
Exactly the files that passed. Your agent can pull them with get_recipe("cache-manager-memory-store") (install), or see them on GitHub.
package.json
{
"name": "cache-manager-memory-store",
"private": true,
"type": "module",
"scripts": {
"test": "node --import tsx --test test/*.test.ts"
},
"dependencies": {
"cache-manager": "7.2.9",
"keyv": "6.1.0"
},
"devDependencies": {
"@types/node": "26.6.5",
"tsx": "4.23.15"
}
}
src/cache.ts
import { createCache } from "cache-manager";
import Keyv from "keyv";
export function createAppCache(ttl = 5000) {
return createCache({
stores: [new Keyv()],
ttl,
});
}
export async function setMany(
cache: ReturnType<typeof createAppCache>,
entries: Array<{ key: string; value: unknown; ttl?: number }>,
) {
return cache.mset(entries);
}
export async function getMany(cache: ReturnType<typeof createAppCache>, keys: string[]) {
return cache.mget(keys);
}
test/cache.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { createAppCache, getMany, setMany } from "../src/cache.ts";
test("set and get roundtrip", async () => {
const cache = createAppCache();
await cache.set("user", { id: 7 });
assert.deepEqual(await cache.get("user"), { id: 7 });
await cache.del("user");
assert.equal(await cache.get("user"), undefined);
await cache.disconnect();
});
test("mset and mget roundtrip", async () => {
const cache = createAppCache();
await setMany(cache, [
{ key: "a", value: 1 },
{ key: "b", value: 2 },
]);
assert.deepEqual(await getMany(cache, ["a", "b"]), [1, 2]);
await cache.clear();
assert.deepEqual(await getMany(cache, ["a", "b"]), [undefined, undefined]);
await cache.disconnect();
});
Connect to ProvenPin
Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.
terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp
~/.cursor/mcp.json
{ "mcpServers": { "provenpin": { "url": "https://mcp.provenpin.com/mcp" } } }.vscode/mcp.json
{ "servers": { "provenpin": { "type": "http", "url": "https://mcp.provenpin.com/mcp" } } }~/.codeium/windsurf/mcp_config.json
{ "mcpServers": { "provenpin": { "serverUrl": "https://mcp.provenpin.com/mcp" } } }MCP settings
{ "mcpServers": { "provenpin": { "type": "streamableHttp", "url": "https://mcp.provenpin.com/mcp" } } }Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.