unstale

npm / keyv

keyv

What changed in keyv 5 to 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

84 breaking5 deprecations23 new APIs and options1 performance10 behavior and defaults2 tooling14 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

keyv 6124 changes

Breaking changes 76

  • AES-CBC is no longer accepted by the encryption packages.

    6.1.0release notes

  • A namespaced clear fails rather than wiping a store it cannot list; provide keys() or iterator(), or clear without a namespace.

    6.1.0release notesupgrade guide

  • Attaching an error listener makes failed calls return a fallback value; without one, failed calls reject.

    6.1.0release notesupgrade guide

  • The namespace separator option is now namespaceSeparator; keyPrefixSeparator is gone.

    6.1.0release notesupgrade guide

  • The namespace separator option is now namespaceSeparator; keySeparator is gone.

    6.1.0release notes

  • The package accepts only AES-GCM, AES-CCM, and ChaCha20-Poly1305 with base64, base64url, or hex output; AES-CBC is removed.

    6.1.0release notes

  • The package accepts only AES-GCM; AES-CBC is removed.

    6.1.0release notes

  • The @keyv/etcd store's lease property is removed; remove code that reads or assigns it.

    6.1.0upgrade guiderelease notes

  • Several adapters store keys beginning with <namespace>: as given instead of treating them as already prefixed.

    6.1.0release notes

  • Set this option to true on an etcd store without a namespace to restore whole-store clear() and iterator() behavior.

    6.1.0upgrade guiderelease notes

  • Redis clear matches the namespace literally rather than as a glob pattern.

    6.1.0release notes

  • Replacing the Redis client removes the old client's listeners.

    6.1.0release notes

  • Redis iterator matches the namespace literally rather than as a glob pattern.

    6.1.0release notesupgrade guide

  • Rejected memcache writes return false.

    6.1.0release notes

  • Writes fail when an encryption adapter is set and serialization is off; serialization remains on by default.

    6.1.0release notesupgrade guide

  • The Dynamo option is removed; use Keyv's ttl option for a default expiry.

    6.1.0release notes

  • Setting storeSize keeps every entry and no longer emits clear.

    6.1.0release notesupgrade guide

  • The option is removed; failed calls return a fallback value when an error listener is attached and reject when none is.

    6.1.0release notesupgrade guide

  • Dynamo keys written without a TTL no longer expire; set Keyv's ttl option for a default expiry.

    6.1.0release notesupgrade guide

  • Valkey clear removes only its own namespace, not namespaces that share its prefix.

    6.1.0release notes

  • Valkey reads return undefined, never null.

    6.1.0release notes

  • This alias for onHook registers a hook.

    6.0.0upgrade guide

  • Without a namespace, clear may remove more than the calling Keyv instance's entries; set a namespace when the backend is shared.

    6.0.0upgrade guide

  • The export was removed.

    6.0.0upgrade guide

  • Passing a connection string or uri option no longer loads an adapter; Keyv quietly uses an in-memory store. Pass an adapter instead.

    6.0.0upgrade guide

  • Keyv no longer defaults to the keyv namespace or prefixes keys, so v5 data may appear missing unless the v5 namespace and storage layout are configured.

    6.0.0upgrade guide

  • Passing an array now returns a boolean array, matching deleteMany; a single key still returns one boolean.

    6.0.0upgrade guide

  • The method now returns boolean[] instead of a single boolean.

    6.0.0upgrade guide

  • Detects whether a value is compatible with Keyv.

    6.0.0upgrade guide

  • Detects storage capabilities and identifies map-like stores.

    6.0.0upgrade guide

  • The property has been removed.

    6.0.0upgrade guide

  • The option has been removed.

    6.0.0upgrade guide

  • Empty-string keys are rejected: set and delete return false, while get returns undefined.

    6.0.0upgrade guide

  • The v6 storage-adapter contract passes an absolute Unix timestamp in milliseconds to set and in KeyvStorageEntry entries, instead of relative TTL values.

    6.0.0upgrade guide

  • The raw option is no longer supported; use getRaw instead.

    6.0.0upgrade guide

  • Raw support was removed; use getManyRaw to retrieve raw values.

    6.0.0upgrade guide

  • With the default checkExpired behavior enabled, has reads and decodes the entry to skip expired values.

    6.0.0upgrade guide

  • Hook payloads now carry the key passed by the caller rather than the prefixed key.

    6.0.0upgrade guide

  • Keyv now extends Hookified directly, replacing its custom event and hook manager classes.

    6.0.0upgrade guide

  • The property now exposes a Map<string, IHook[]> instead of the former handlers property.

    6.0.0upgrade guide

  • Hooks are awaited, so asynchronous hooks delay the operation they belong to.

    6.0.0upgrade guide

  • The type now comes from hookified.

    6.0.0upgrade guide

  • Custom asynchronous stores need iterator() for Keyv to find entries belonging to a namespace during clear.

    6.0.0upgrade guide

  • Now a built-in async generator method requiring no arguments; namespace handling is automatic, and expired entries are filtered and deleted during iteration.

    6.0.0upgrade guide

  • The type was removed.

    6.0.0upgrade guide

  • The old @keyv/redis separator name is no longer supported; JavaScript ignores the option and TypeScript reports it as an error.

    6.0.0upgrade guide

  • Custom synchronous Map-like stores need keys() for Keyv to find entries belonging to a namespace during clear.

    6.0.0upgrade guide

  • Without a namespace, clear() and iterator() now touch only entries Keyv wrote without a namespace.

    6.0.0upgrade guide

  • The adapter switches from memjs to memcache. Update any memjs-specific client options; the adapter API is unchanged for default settings.

    6.0.0upgrade guide

  • clear() invalidates only the store's own namespace entries instead of flushing the whole Memcached server.

    6.0.0upgrade guide

  • The package is not part of v6; remove it from project dependencies when migrating.

    6.0.0upgrade guide

  • The package has no default export; named suites take Vitest's test or it function as the first argument, and suite names changed.

    6.0.0upgrade guide

  • For a Map or older adapter, returns the Keyv-created wrapper; the original object is available at keyv.store.store.

    6.0.0upgrade guide

  • Compression adapters now implement an interface whose compress and decompress methods take a string and resolve to a string; v5 compressed data cannot be read by v6.

    6.0.0upgrade guide

  • Renamed to compressionTestSuite.

    6.0.0upgrade guide

  • setMany now uses KeyvEntry[] as its input type.

    6.0.0upgrade guide

  • Renamed to keyvNamespaceTests.

    6.0.0upgrade guide

  • Storage adapters receive absolute expires instead of relative ttl.

    6.0.0upgrade guide

  • A Map now holds { value, expires } objects under namespace::key, or the bare key without a namespace, rather than serialized strings under keyv:key.

    6.0.0upgrade guide

  • Keyv normalizes missing values to undefined instead of passing through adapter-specific null values.

    6.0.0upgrade guide

  • Namespace handling moves to storage adapters; an adapter's namespace is retained when Keyv has none, while a namespace passed to Keyv takes precedence.

    6.0.0upgrade guide

  • Adapters that join namespace and key use :: by default; configure this option to use another separator, such as : for v5 key layouts.

    6.0.0upgrade guide

  • Every v6 package requires Node.js 22.19 or later, so update runtimes, CI matrices, and pinned runtime versions.

    6.0.0upgrade guide

  • Use this method instead of keyv.hooks.addHandler to register a hook.

    6.0.0upgrade guide

  • The property is removed from Keyv and the KeyvStorageAdapter interface; use direct property access instead.

    6.0.0upgrade guide

  • Use this method with an event and handler object instead of keyv.hooks.removeHandler.

    6.0.0upgrade guide

  • This option replaces serialize and deserialize and accepts an adapter with stringify and parse methods.

    6.0.0upgrade guide

  • Set the option to false to disable serialization.

    6.0.0upgrade guide

  • The option is ignored in plain JavaScript and has no effect.

    6.0.0upgrade guide

  • The method now accepts KeyvEntry[] and returns boolean[] instead of a single boolean.

    6.0.0upgrade guide

  • The @keyv/dynamo store's sixHoursInMilliseconds property is removed.

    6.0.0upgrade guide

  • The v5 methods hit(), miss(), set(), delete(), and hitsOrMisses() were removed; getMany now records a hit or miss per key.

    6.0.0upgrade guide

  • Symbols can no longer be stored; setting one emits an error and either rejects or returns false depending on whether an error listener is attached.

    6.0.0upgrade guide

  • A TTL of zero or less means no TTL, and fractional TTLs are rounded up to the next millisecond.

    6.0.0upgrade guide

  • Storage adapters no longer declare ttlSupport; Keyv detects the store and wraps older adapters or synchronous Map-like stores as needed.

    6.0.0upgrade guide

  • The option and property are removed; Keyv no longer handles key prefixing.

    6.0.0upgrade guide

Deprecations 5

  • Remains available as a deprecated alias of KeyvValue.

    6.0.0upgrade guide

  • Keyv v5 enters maintenance mode; it will receive maintenance and security fixes but no major functionality.

    6.0.0upgrade guide

  • Remains available as a deprecated alias of KeyvCompressionAdapter.

    6.0.0upgrade guide

  • Hook names use the before: and after: convention; old PRE_/POST_ enum values remain deprecated but functional and emit a warning.

    6.0.0upgrade guide

  • Remains available as a deprecated alias of KeyvStorageAdapter.

    6.0.0upgrade guide

New APIs and options 17

  • Redis createKeyv accepts cluster and sentinel options.

    6.1.0release notes

  • Adapters that join the namespace and key accept namespaceSeparator, which defaults to ::.

    6.1.0release notes

  • A v6 storage adapter advertises the absolute-expiry contract with capabilities.expires === true; keyvStorageCapability(this) builds the capability descriptor.

    6.0.0upgrade guide

  • Defaults to true, so Keyv filters expired reads using the serialized envelope; set it to false to trust the backend and skip the extra decode on reads.

    6.0.0upgrade guide

  • Detects whether a compression adapter is compatible.

    6.0.0upgrade guide

  • Detects whether an encryption adapter is compatible.

    6.0.0upgrade guide

  • Detects whether a serialization adapter is compatible.

    6.0.0upgrade guide

  • Keyv accepts an encryption adapter for values; encryption operates on serialized strings and requires serialization to be enabled.

    6.0.0upgrade guide

  • Use this method instead of getMany(keys, { raw: true }) to access raw values.

    6.0.0upgrade guide

  • Use this method instead of get(key, { raw: true }) to access raw values.

    6.0.0upgrade guide

  • Adds a Node.js crypto encryption adapter supporting AES-GCM, AES-CCM, and ChaCha20-Poly1305.

    6.0.0upgrade guide

  • Adds a Web Crypto API encryption adapter for browsers, Workers, and Deno.

    6.0.0upgrade guide

  • Provides a high-performance binary MessagePack serialization adapter.

    6.0.0upgrade guide

  • Provides a serialization adapter supporting Date, Map, Set, RegExp, URL, Error, and undefined values.

    6.0.0upgrade guide

  • The built-in JSON serializer is the default and writes the same format as v5's @keyv/serialize and v4's json-buffer.

    6.0.0upgrade guide

  • A new adapter handles advanced features for legacy storage adapters and Map-compatible stores.

    6.0.0upgrade guide

  • Keyv exposes serialization for configuring serializers; the built-in KeyvJsonSerializer is the default, and serialization can be disabled or replaced with a custom adapter.

    6.0.0upgrade guide

Performance 1

  • Intervals over 24.8 days no longer run cleanup every millisecond.

    6.1.0release notes

Behavior and default changes 10

  • Keyv uses a namespace set on the storage adapter when Keyv itself has none.

    6.1.0release notes

  • Memcache clear removes only the store's own entries; use noNamespaceAffectsAll on an unnamespaced store to flush the server.

    6.1.0release notes

  • The Redis connection timeout covers the handshake, and timed-out connects close their sockets.

    6.1.0release notes

  • Postgres deleteMany runs as one statement.

    6.1.0release notes

  • GridFS reads the newest revision, and delete removes every revision.

    6.1.0release notes

  • MySQL tables get a primary key on (namespace, id), and existing tables are migrated on connect.

    6.1.0release notes

  • Promise-based stores without async methods now go through KeyvBridgeAdapter.

    6.1.0release notes

  • Changing storeHashFunction now relocates entries under the new hash function without losing or duplicating them.

    6.0.0upgrade guide

  • Keyv can now be used in browser environments with appropriate storage adapters.

    6.0.0upgrade guide

  • Keys with whitespace or control characters, and keys over 250 bytes, are stored under a SHA-256 digest of the namespaced key.

    6.0.0upgrade guide

Tooling 1

  • A published agent skill upgrades a project from Keyv v4 or v5 to v6.

    6.1.0release notes

Fixes and other changes 14

  • The etcd value envelope uses Keyv's JSON serializer so BigInt values round-trip.

    6.1.0release notes

  • The etcd value envelope uses Keyv's JSON serializer so Buffer values round-trip.

    6.1.0release notes

  • Without a namespace, etcd clear only touches entries Keyv wrote without a namespace.

    6.1.0release notes

  • The Redis helper stops reconnecting to a server that is down.

    6.1.0release notes

  • Fractional TTLs no longer fail writes.

    6.1.0release notes

  • Without a namespace, etcd iterator only touches entries Keyv wrote without a namespace.

    6.1.0release notes

  • Keys memcached cannot store now work.

    6.1.0release notes

  • Concurrent operations during the handshake share one connect instead of failing.

    6.1.0release notes

  • Redis missing values are undefined.

    6.1.0release notes

  • Etcd setMany reports failed writes as false.

    6.1.0release notes

  • Postgres SQL NULL reads as undefined.

    6.1.0release notes

  • The sqlite3 driver no longer hangs after a failed statement.

    6.1.0release notes

  • Valkey useSets works in cluster mode.

    6.1.0release notes

  • Keyv packages and adapters share a version number and are released together, simplifying compatible upgrades across the ecosystem.

    6.0.0upgrade guide

keyv 515 changes

Breaking changes 8

  • Entries without a TTL omit expires; check for undefined rather than null.

    5.0.0upgrade guide

  • The CommonJS class export changed from the module itself to named and default exports, so the v4 require form fails.

    5.0.0upgrade guide

  • The package was removed; use Cacheable for offline fallbacks or a fast in-memory layer in front of a remote store.

    5.0.0upgrade guide

  • The type now takes only the value type parameter; the options type parameter from v4 is no longer used.

    5.0.0upgrade guide

  • The adapter uses the official redis client instead of ioredis; ioredis instances and its exclusive options are no longer supported.

    5.0.0upgrade guide

  • Keyv v5 uses @keyv/serialize for serialization; it writes the same format as v4.

    5.0.0upgrade guide

  • A failed write is now reported rather than always resolving true.

    5.0.0upgrade guide

  • Pass a storage adapter directly or through the store option; connection strings silently fall back to an in-memory store instead of loading an adapter.

    5.0.0upgrade guide

New APIs and options 6

  • Keyv ships an ESM build alongside its CommonJS build.

    5.0.0upgrade guide

  • Keyv has its own event emitter and emits events for set, delete, clear, and error without third-party libraries.

    5.0.0upgrade guide

  • Hooks support pre- and post-processing on set, get, getMany, and delete.

    5.0.0upgrade guide

  • The method accepts an array of keys.

    5.0.0upgrade guide

  • A new method was added for checking multiple keys.

    5.0.0upgrade guide

  • Built-in statistics track hits, misses, sets, deletes, and errors.

    5.0.0upgrade guide

Tooling 1

  • Keyv is written in TypeScript and ships its own types.

    5.0.0upgrade guide