Skip to content

Repository files navigation

@platformatic/memcached

A minimal, high-performance memcached client for Node.js, built on the meta text protocol.

This repository is a pnpm workspace.

Packages

Package Documentation Description
@platformatic/memcached Client README The memcached client: meta protocol, full request pipelining, zero runtime dependencies.
@platformatic/memcached-otel OpenTelemetry README OpenTelemetry tracing instrumentation for the client, built on its diagnostics channels.

Quick start

npm install @platformatic/memcached
import { Client } from '@platformatic/memcached'

const client = new Client('localhost:11211')

await client.set('greeting', 'hello', { ttl: 60 })
const value = await client.get('greeting')

console.log(value?.toString()) // 'hello'

await client.close()

For complete usage and API details, see the client documentation:

Performance

SET/GET throughput against the notable Node.js memcached clients, each running with its best-known configuration — this client and memjs pipeline on a single connection, while memcache-client and memcached (3rd-Eden) get a 10-connection pool. Median of 3 runs, 50,000 operations at concurrency 500, memcached:alpine on loopback, Node.js 24, Linux:

ops/s @platformatic/memcached memjs memcache-client (pool 10) memcached (pool 10)
SET 64 B 352,000 111,000 138,000 43,000
GET 64 B 369,000 137,000 113,000 59,000
SET 4 KiB 168,000 80,000 92,000 31,000
GET 4 KiB 135,000 92,000 87,000 10,000

Absolute numbers vary by machine: reproduce with node packages/memcached/benchmarks/compare-all.js (details in the client's performance notes).

Development

pnpm install
pnpm build        # build every package
pnpm lint         # lint the whole workspace
pnpm typecheck    # typecheck every package
pnpm test         # run every package's tests

Tests run against a real memcached; pnpm test starts a memcached:alpine Docker container automatically (and stops it afterwards). Source is TypeScript in the erasable subset, executed directly by Node.js >= 22.18.0 via type stripping; published packages ship compiled JavaScript and declaration files.

License

Apache-2.0 — see LICENSE.

About

Minimal, high-performance memcached client for Node.js based on the meta protocol

Resources

Code of conduct

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages