{"_id":"@ambicuity/valkey","_rev":"5-6e675dd3ac3de169e07958cfc370291c","name":"@ambicuity/valkey","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@ambicuity/valkey","version":"1.0.0","keywords":["redis","valkey","valkeyio","ioredis","storely","storage","adapter","key","value","store","cache","ttl"],"author":{"name":"Ritesh Rana","email":"contact@riteshrana.engineer"},"license":"MIT","_id":"@ambicuity/valkey@1.0.0","maintainers":[{"name":"ambicuity","email":"riteshrana36@gmail.com"}],"tsd":{"directory":"test"},"dist":{"shasum":"61a4a1d03bae80140e6a57f0956b84581d2a941e","tarball":"https://registry.npmjs.org/@ambicuity/valkey/-/valkey-1.0.0.tgz","fileCount":7,"integrity":"sha512-wqxQJaKWFY4i/PnIVMX1akOVHi8D1BG9mtK1d114FFDcOA1OGE7D5fIKk1zn2vVsV8hLHf3ZMo4doQ9QRFLOKw==","signatures":[{"sig":"MEUCIEDTcdj4Qo/QyPLFMqlWsgufdgVrQWHGqS5PYf8lukpzAiEA1EcX/Eg4XKrAzwAZHYmAh82+yU5XsSphErzzAMqMD30=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":284646},"main":"./dist/index.mjs","type":"module","_from":"file:ambicuity-valkey-1.0.0.tgz","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">= 18"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"lint":"biome check --write --error-on-warnings","test":"pnpm lint && vitest run --coverage","build":"tsdown","clean":"rimraf ./node_modules ./coverage ./dist","lint:ci":"biome check --error-on-warnings","test:ci":"pnpm lint:ci && vitest --run --sequence.setupFiles=list --coverage"},"_npmUser":{"name":"ambicuity","email":"riteshrana36@gmail.com"},"_resolved":"/private/var/folders/tc/9srvxb_11h5bpdgnjy16lbqr0000gn/T/a1980b247b5e1026b4fb59b9ea0be6a6/ambicuity-valkey-1.0.0.tgz","_integrity":"sha512-wqxQJaKWFY4i/PnIVMX1akOVHi8D1BG9mtK1d114FFDcOA1OGE7D5fIKk1zn2vVsV8hLHf3ZMo4doQ9QRFLOKw==","_npmVersion":"11.12.1","description":"Valkey storage adapter for Storely","directories":{},"_nodeVersion":"25.9.0","dependencies":{"iovalkey":"^0.3.3","hookified":"^2.0.0","cluster-key-slot":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","rimraf":"^6.1.2","vitest":"^4.0.15","timekeeper":"^2.3.1","@biomejs/biome":"^2.3.8","@faker-js/faker":"^10.2.0","@ambicuity/storely":"^1.0.0","@vitest/coverage-v8":"^4.0.15","@ambicuity/test-suite":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/valkey_1.0.0_1778541878185_0.3622387443522952","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @ambicuity/storely instead."},"1.0.1":{"name":"@ambicuity/valkey","version":"1.0.1","keywords":["redis","valkey","valkeyio","ioredis","storely","storage","adapter","key","value","store","cache","ttl"],"author":{"name":"Ritesh Rana","email":"contact@riteshrana.engineer"},"license":"MIT","_id":"@ambicuity/valkey@1.0.1","maintainers":[{"name":"ambicuity","email":"riteshrana36@gmail.com"}],"tsd":{"directory":"test"},"dist":{"shasum":"02a05223bbccccfcc20408d1c6bf608719cd552c","tarball":"https://registry.npmjs.org/@ambicuity/valkey/-/valkey-1.0.1.tgz","fileCount":7,"integrity":"sha512-8Flx79qGV9S4D/l8Nxi/vejXVu9ANVGcqhCJzZjrSszw8QmlAWoGNXkO1+5ZQw8AK1bqBEYR5S5NXwAPOKJCZg==","signatures":[{"sig":"MEYCIQDxybEWijIptkGvIkkaHWkY8Z72ZgAWIPaNL92aRgJslwIhAMKzaHudnB0+SZ+OCo31isCT7Pl4ZytzhzWwr/8QkrwL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":284681},"main":"./dist/index.mjs","type":"module","_from":"file:ambicuity-valkey-1.0.1.tgz","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">= 18"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"lint":"biome check --write --error-on-warnings","test":"pnpm lint && vitest run --coverage","build":"tsdown","clean":"rimraf ./node_modules ./coverage ./dist","lint:ci":"biome check --error-on-warnings","test:ci":"pnpm lint:ci && vitest --run --sequence.setupFiles=list --coverage"},"_npmUser":{"name":"ambicuity","email":"riteshrana36@gmail.com"},"_resolved":"/private/var/folders/tc/9srvxb_11h5bpdgnjy16lbqr0000gn/T/ed2b296993524a34d261c84e20180bec/ambicuity-valkey-1.0.1.tgz","_integrity":"sha512-8Flx79qGV9S4D/l8Nxi/vejXVu9ANVGcqhCJzZjrSszw8QmlAWoGNXkO1+5ZQw8AK1bqBEYR5S5NXwAPOKJCZg==","_npmVersion":"11.12.1","description":"Valkey storage adapter for Storely","directories":{},"_nodeVersion":"25.9.0","dependencies":{"iovalkey":"^0.3.3","hookified":"^2.0.0","cluster-key-slot":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","rimraf":"^6.1.2","vitest":"^4.0.15","timekeeper":"^2.3.1","@biomejs/biome":"^2.3.8","@faker-js/faker":"^10.2.0","@vitest/coverage-v8":"^4.0.15","@ambicuity/test-suite":"^1.0.1","@ambicuity/storely-core":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/valkey_1.0.1_1778543126628_0.4772237877721983","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @ambicuity/storely instead."},"1.0.2":{"name":"@ambicuity/valkey","version":"1.0.2","keywords":["redis","valkey","valkeyio","ioredis","storely","storage","adapter","key","value","store","cache","ttl"],"author":{"name":"Ritesh Rana","email":"contact@riteshrana.engineer"},"license":"MIT","_id":"@ambicuity/valkey@1.0.2","maintainers":[{"name":"ambicuity","email":"riteshrana36@gmail.com"}],"tsd":{"directory":"test"},"dist":{"shasum":"a207ca80c6275236d4494cfcd7b672d7ced340d2","tarball":"https://registry.npmjs.org/@ambicuity/valkey/-/valkey-1.0.2.tgz","fileCount":7,"integrity":"sha512-5yPAGzG/zE6vyk1Qy2D7vshjL4tcHwc5LvuwUEJhbNImIJuDjqL/Gp9PDmgxB5lF0j843Ru2z8lESI0lPs2Dug==","signatures":[{"sig":"MEQCIE63RbBLBTXz/ZAElySThhNkRKFzeqlwOqn3g9lrpzYtAiB+3SBOXOE4bm3WyqNncEdfTrCvF08FTBIFHD1Ots2SGw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":284625},"main":"./dist/index.mjs","type":"module","_from":"file:ambicuity-valkey-1.0.2.tgz","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">= 18"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"lint":"biome check --write --error-on-warnings","test":"pnpm lint && vitest run --coverage","build":"tsdown","clean":"rimraf ./node_modules ./coverage ./dist","lint:ci":"biome check --error-on-warnings","test:ci":"pnpm lint:ci && vitest --run --sequence.setupFiles=list --coverage"},"_npmUser":{"name":"ambicuity","email":"riteshrana36@gmail.com"},"_resolved":"/private/var/folders/tc/9srvxb_11h5bpdgnjy16lbqr0000gn/T/8b3cdc595b626ef019069ebe11d8058a/ambicuity-valkey-1.0.2.tgz","_integrity":"sha512-5yPAGzG/zE6vyk1Qy2D7vshjL4tcHwc5LvuwUEJhbNImIJuDjqL/Gp9PDmgxB5lF0j843Ru2z8lESI0lPs2Dug==","_npmVersion":"11.12.1","description":"Valkey storage adapter for Storely","directories":{},"_nodeVersion":"25.9.0","dependencies":{"iovalkey":"^0.3.3","hookified":"^2.0.0","cluster-key-slot":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","rimraf":"^6.1.2","vitest":"^4.0.15","timekeeper":"^2.3.1","@biomejs/biome":"^2.3.8","@ambicuity/core":"^1.0.2","@faker-js/faker":"^10.2.0","@vitest/coverage-v8":"^4.0.15","@ambicuity/test-suite":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/valkey_1.0.2_1778543470803_0.5451115285795609","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @ambicuity/storely instead."},"1.0.3":{"name":"@ambicuity/valkey","version":"1.0.3","keywords":["redis","valkey","valkeyio","ioredis","storely","storage","adapter","key","value","store","cache","ttl"],"author":{"name":"Ritesh Rana","email":"contact@riteshrana.engineer"},"license":"MIT","_id":"@ambicuity/valkey@1.0.3","maintainers":[{"name":"ambicuity","email":"riteshrana36@gmail.com"}],"tsd":{"directory":"test"},"dist":{"shasum":"730a57ebde585d9c40437e9a2c5d911ea1bc924d","tarball":"https://registry.npmjs.org/@ambicuity/valkey/-/valkey-1.0.3.tgz","fileCount":7,"integrity":"sha512-Uotkn7II3KuqM39p0pF1ubDDK3KKdup+xKU4DX6Agp7xaan/xOuTICSgzzHTSZnpIX0QmgxhD5HylG/8L7gMaA==","signatures":[{"sig":"MEUCIQDJQ74gtV/crQFua1WKIfj1RcBxARS0GAZ7lCw22yaNJgIgGH9zZd6+OAoN9sVw4VWTFElkzm6uQPWfODNy4HEiaBk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":284653},"main":"./dist/index.mjs","type":"module","_from":"file:ambicuity-valkey-1.0.3.tgz","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">= 18"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"lint":"biome check --write --error-on-warnings","test":"pnpm lint && vitest run --coverage","build":"tsdown","clean":"rimraf ./node_modules ./coverage ./dist","lint:ci":"biome check --error-on-warnings","test:ci":"pnpm lint:ci && vitest --run --sequence.setupFiles=list --coverage"},"_npmUser":{"name":"ambicuity","email":"riteshrana36@gmail.com"},"_resolved":"/private/var/folders/tc/9srvxb_11h5bpdgnjy16lbqr0000gn/T/e7df45b41142217479f17b16135c911e/ambicuity-valkey-1.0.3.tgz","_integrity":"sha512-Uotkn7II3KuqM39p0pF1ubDDK3KKdup+xKU4DX6Agp7xaan/xOuTICSgzzHTSZnpIX0QmgxhD5HylG/8L7gMaA==","_npmVersion":"11.12.1","description":"Valkey storage adapter for Storely","directories":{},"_nodeVersion":"25.9.0","dependencies":{"iovalkey":"^0.3.3","hookified":"^2.0.0","cluster-key-slot":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","rimraf":"^6.1.2","vitest":"^4.0.15","timekeeper":"^2.3.1","@biomejs/biome":"^2.3.8","@faker-js/faker":"^10.2.0","@ambicuity/ambicore":"^1.0.3","@vitest/coverage-v8":"^4.0.15","@ambicuity/test-suite":"^1.0.3"},"_npmOperationalInternal":{"tmp":"tmp/valkey_1.0.3_1778543873786_0.19015361001765285","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @ambicuity/storely instead."}},"time":{"created":"2026-05-11T23:24:38.098Z","modified":"2026-05-14T01:27:36.633Z","1.0.0":"2026-05-11T23:24:38.417Z","1.0.1":"2026-05-11T23:45:26.784Z","1.0.2":"2026-05-11T23:51:10.978Z","1.0.3":"2026-05-11T23:57:53.952Z"},"author":{"name":"Ritesh Rana","email":"contact@riteshrana.engineer"},"license":"MIT","keywords":["redis","valkey","valkeyio","ioredis","storely","storage","adapter","key","value","store","cache","ttl"],"description":"Valkey storage adapter for Storely","maintainers":[{"name":"ambicuity","email":"riteshrana36@gmail.com"}],"readme":"\n> Valkey storage adapter for Storely\n\n[![npm](https://img.shields.io/npm/v/@ambicuity/valkey.svg)](https://www.npmjs.com/package/@ambicuity/valkey)\n[![npm](https://img.shields.io/npm/dm/@ambicuity/valkey)](https://npmjs.com/package/@ambicuity/valkey)\n\n[Valkey](https://valkey.io) storage adapter for Storely.\n\nValkey is the open source replacement to Redis which decided to do a [dual license](https://redis.com/blog/redis-adopts-dual-source-available-licensing/) approach moving forward. Valkey is a drop-in replacement for Redis and is fully compatible with the Redis protocol.\n\nWe are using the [iovalkey](https://www.npmjs.com/package/iovalkey) which is a Node.js client for Valkey based on the `ioredis` client.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Migrating to v6](#migrating-to-v6)\n- [Constructor Options](#constructor-options)\n- [Properties](#properties)\n  - [namespace](#namespace)\n  - [useSets](#usesets)\n  - [useRedisSets (deprecated)](#useredisSets-deprecated)\n  - [client](#client)\n- [Methods](#methods)\n  - [.get(key)](#getkey)\n  - [.getMany(keys)](#getmanykeys)\n  - [.set(key, value, ttl?)](#setkey-value-ttl)\n  - [.setMany(entries)](#setmanyentries)\n  - [.delete(key)](#deletekey)\n  - [.deleteMany(keys)](#deletemanykeys)\n  - [.has(key)](#haskey)\n  - [.hasMany(keys)](#hasmanykeys)\n  - [.clear()](#clear)\n  - [.iterator()](#iterator)\n  - [.disconnect()](#disconnect)\n- [Clustering](#clustering)\n- [License](#license)\n\n# Install\n\n```shell\nnpm install --save storely @ambicuity/valkey\n```\n\n# Usage\n\nThis is using the helper `createStorely` function to create a Storely instance with the Valkey storage adapter:\n\n```js\nimport {createStorely} from '@ambicuity/valkey';\n\nconst storely = createStorely('redis://localhost:6379');\nstorely.on('error', handleConnectionError);\nawait storely.set('foo', 'bar');\nconsole.log(await storely.get('foo')); // 'bar'\n```\n\nIf you want to specify the `StorelyValkey` class directly, you can do so:\n\n```js\nimport Storely from '@ambicuity/ambicore';\nimport StorelyValkey from '@ambicuity/valkey';\n\nconst storely = new Storely(new StorelyValkey('redis://user:pass@localhost:6379', { disable_resubscribing: true }));\n```\n\nOr you can manually create a storage adapter instance and pass it to Storely:\n\n```js\nimport Storely from '@ambicuity/ambicore';\nimport StorelyValkey from '@ambicuity/valkey';\n\nconst StorelyValkey = new StorelyValkey('redis://user:pass@localhost:6379');\nconst storely = new Storely({ store: StorelyValkey });\n```\n\nOr reuse a previous Redis instance:\n\n```js\nimport Storely from '@ambicuity/ambicore';\nimport Redis from 'iovalkey';\nimport StorelyValkey from '@ambicuity/valkey';\n\nconst redis = new Redis('redis://user:pass@localhost:6379');\nconst StorelyValkey = new StorelyValkey(redis);\nconst storely = new Storely({ store: StorelyValkey });\n```\n\nOr reuse a previous Redis cluster:\n\n```js\nimport Storely from '@ambicuity/ambicore';\nimport Redis from 'iovalkey';\nimport StorelyValkey from '@ambicuity/valkey';\n\nconst redis = new Redis.Cluster('redis://user:pass@localhost:6379');\nconst StorelyValkey = new StorelyValkey(redis);\nconst storely = new Storely({ store: StorelyValkey });\n```\n## Migrating to v6\n\n### Breaking changes\n\n#### Properties instead of opts\n\nIn v6, all configuration options are exposed as top-level properties with getters and setters:\n\n```js\n// v6\nstore.useSets; // true\nstore.useSets = false;\n```\n\nThe `opts` getter still exists for backward compatibility but should not be used for new code.\n\n#### `useRedisSets` renamed to `useSets`\n\nThe `useRedisSets` option has been renamed to `useSets`. The `useRedisSets` property is still available as a deprecated getter/setter on the class but will be removed in a future version.\n\n#### `redis` property renamed to `client`\n\nThe `redis` property has been renamed to `client` and is now properly typed as `Redis | Cluster` instead of `any`. Update any code that accesses the underlying iovalkey instance:\n\n```js\n// v5\nstore.redis;\n\n// v6\nstore.client;\n```\n\n#### `useSets` default changed from `true` to `false`\n\nThe default value of `useSets` has changed from `true` to `false` for performance reasons. When enabled, a set is maintained for each namespace to track keys, which can lead to memory leaks in high-throughput scenarios. If you depend on the previous behavior, explicitly set `useSets: true` in your options:\n\n```js\nconst store = new StorelyValkey('redis://localhost:6379', { useSets: true });\n```\n\n#### `useSets` key prefix changed from `namespace:` to `sets:`\n\nWhen `useSets` is enabled, all keys (both data keys and the SET tracking key) now use a `sets:` prefix instead of `namespace:`. This prevents `WRONGTYPE` collisions between the SET tracking key and regular string data keys that could share the same name.\n\n- **Data keys**: `sets:<namespace>:<key>` (was `namespace:<namespace>:<key>`)\n- **SET tracking key**: `sets:<namespace>` (was `namespace:<namespace>`)\n\nThe `clear()` method automatically detects and cleans up legacy `namespace:`-prefixed SET keys, so no manual migration is needed.\n\n## Constructor Options\n\n`StorelyValkey` accepts a connection URI string, an options object, or an existing iovalkey `Redis`/`Cluster` instance. The options object accepts the following properties along with any [`RedisOptions`](https://github.com/valkey-io/iovalkey#connect-to-valkey) from the `iovalkey` library:\n\n| Option | Type | Default | Description |\n| --- | --- | --- | --- |\n| `uri` | `string` | `undefined` | Valkey connection URI |\n| `useSets` | `boolean` | `false` | Whether to use sets for namespace key management |\n\n## Properties\n\nAll configuration options are exposed as properties with getters and setters on the `StorelyValkey` instance. You can read or update them after construction.\n\n### namespace\n\nGet or set the namespace for the adapter. Used for key prefixing and scoping operations like `clear()`.\n\n- Type: `string | undefined`\n- Default: `undefined`\n\n```js\nconst store = new StorelyValkey('redis://localhost:6379');\nstore.namespace = 'my-namespace';\nconsole.log(store.namespace); // 'my-namespace'\n```\n\n### useSets\n\nGet or set whether to use sets for key management. When `true`, a set is maintained for each namespace to track keys. When `false`, keys are prefixed with the namespace and pattern matching is used instead.\n\n- Type: `boolean`\n- Default: `false`\n\n```js\nconst store = new StorelyValkey('redis://localhost:6379', { useSets: true });\nconsole.log(store.useSets); // true\n```\n\n**Note**: When `useSets` is `true`, a set is maintained for each namespace which can lead to memory leaks in high-performance scenarios. This is why the default is `false`.\n\nWhen `useSets` is enabled, all keys use the `sets:` prefix (e.g., `sets:myns:mykey`) to isolate them from non-useSets keys. The SET tracking key is stored at `sets:<namespace>`.\n\nWhen `useSets` is `false`, the `clear()` function uses pattern matching (`KEYS` command) to find and delete keys, which may be slower on very large databases.\n\n### useRedisSets (deprecated)\n\nDeprecated alias for `useSets`. Use `useSets` instead.\n\n### client\n\nGet or set the underlying iovalkey `Redis` or `Cluster` client instance.\n\n- Type: `Redis | Cluster`\n\n```js\nimport Redis from 'iovalkey';\n\nconst store = new StorelyValkey('redis://localhost:6379');\nconsole.log(store.client); // Redis instance\n\n// Replace with a new instance\nstore.client = new Redis('redis://localhost:6380');\n```\n\n## Methods\n\n### .get(key)\n\nReturns the value for the given key. Returns `undefined` if the key does not exist.\n\n```js\nconst value = await store.get('foo');\n```\n\n### .getMany(keys)\n\nReturns an array of values for the given keys. Returns `undefined` for any key that does not exist.\n\n```js\nconst values = await store.getMany(['foo', 'bar']);\n```\n\n### .set(key, value, ttl?)\n\nSets a value for the given key with an optional TTL in milliseconds.\n\n```js\nawait store.set('foo', 'bar');\nawait store.set('foo', 'bar', 5000); // expires in 5 seconds\n```\n\n### .setMany(entries)\n\nSets multiple key-value pairs in a single batch operation using `MULTI/EXEC` transactions. Each entry is a `StorelyEntry<Value>` object (`{ key: string, value: Value, ttl?: number }`), where `Value` is inferred from the entries provided. Entries with `undefined` values are skipped. Returns a `boolean[]` with per-entry success tracking by inspecting each command's result. In cluster mode, entries are grouped by hash slot with results mapped back to the original order.\n\n```js\nconst results = await store.setMany([\n  { key: 'foo', value: 'bar' },\n  { key: 'baz', value: 'qux', ttl: 5000 },\n]); // [true, true]\n```\n\n### .delete(key)\n\nDeletes a key-value pair from the store. Returns `true` if the key existed and was deleted, `false` otherwise.\n\n```js\nconst deleted = await store.delete('foo');\n```\n\n### .deleteMany(keys)\n\nDeletes multiple key-value pairs from the store in a single batch operation. Returns a `boolean[]` indicating whether each key was deleted.\n\n```js\nconst results = await store.deleteMany(['foo', 'bar']); // [true, true]\n```\n\n### .has(key)\n\nReturns `true` if the key exists in the store, `false` otherwise.\n\n```js\nconst exists = await store.has('foo');\n```\n\n### .hasMany(keys)\n\nChecks if multiple keys exist in the store in a single batch operation. Returns an array of booleans.\n\n```js\nconst results = await store.hasMany(['foo', 'bar', 'baz']);\n// [true, true, false]\n```\n\n### .clear()\n\nClears all entries from the store. If a namespace is set, only entries within that namespace are cleared.\n\n```js\nawait store.clear();\n```\n\n### .iterator()\n\nReturns an async iterator for iterating over all key-value pairs in the store. The iterator uses the namespace configured on the instance.\n\n```js\nfor await (const [key, value] of store.iterator()) {\n  console.log(key, value);\n}\n```\n\n### .disconnect()\n\nDisconnects from the Valkey server.\n\n```js\nawait store.disconnect();\n```\n\n## Clustering\n\nThe adapter supports Valkey and Redis clusters via iovalkey's `Cluster` class. Pass a `Redis.Cluster` instance directly to the constructor:\n\n```js\nimport StorelyValkey from '@ambicuity/valkey';\nimport Redis from 'iovalkey';\n\nconst cluster = new Redis.Cluster([\n  { host: '127.0.0.1', port: 7001 },\n  { host: '127.0.0.1', port: 7002 },\n  { host: '127.0.0.1', port: 7003 },\n]);\nconst store = new StorelyValkey(cluster);\n```\n\nBatch methods (`getMany`, `setMany`, `deleteMany`, `hasMany`) automatically group keys by hash slot and run separate transactions per slot group. This avoids `CROSSSLOT` errors without any extra configuration.\n\nSingle-key methods (`get`, `set`, `delete`, `has`) work automatically in cluster mode — iovalkey routes each command to the correct node.\n\n### Cluster gotchas\n\n- **`clear()` with `useSets: false` (the default)** uses the `KEYS` command, which only scans the node that receives the command. In cluster mode this may miss keys on other nodes. Set `useSets: true` if you need reliable `clear()` across all cluster nodes.\n- **`iterator()` in cluster mode** uses `SCAN`, which only iterates keys on the node the command is routed to. It may not return all keys across the cluster.\n\n## License\n\n[MIT © Ritesh Rana](LICENSE)\n","readmeFilename":"README.md"}