🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@keyv/redis

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keyv/redis - npm Package Compare versions

Comparing version
5.1.4
to
5.1.5
+19
-13
package.json
{
"name": "@keyv/redis",
"version": "5.1.4",
"version": "5.1.5",
"description": "Redis storage adapter for Keyv",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.js"
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
},
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}

@@ -37,17 +43,17 @@ },

"dependencies": {
"@redis/client": "^5.9.0",
"@redis/client": "^5.10.0",
"cluster-key-slot": "^1.1.2",
"hookified": "^1.12.2"
"hookified": "^1.13.0"
},
"peerDependencies": {
"keyv": "^5.5.4"
"keyv": "^5.5.5"
},
"devDependencies": {
"@biomejs/biome": "^2.3.4",
"@biomejs/biome": "^2.3.8",
"@faker-js/faker": "^10.1.0",
"@vitest/coverage-v8": "^4.0.8",
"rimraf": "^6.1.0",
"@vitest/coverage-v8": "^4.0.15",
"rimraf": "^6.1.2",
"timekeeper": "^2.3.1",
"tsd": "^0.33.0",
"vitest": "^4.0.8",
"vitest": "^4.0.15",
"@keyv/test-suite": "^2.1.2"

@@ -54,0 +60,0 @@ },

@@ -221,2 +221,10 @@ # @keyv/redis [<img width="100" align="right" src="https://jaredwray.com/images/keyv-symbol.svg" alt="keyv">](https://github.com/jaredwra/keyv)

By default namespacing is turned off, this is done because it causes much more memory / performance usage for Redis.
Redis does **not** treat colons (`:`) or namespaces as special—there are no hierarchical keys or namespace mechanics internally. The dramatic memory savings you see when removing prefixes like `namespace:` come from one thing: **key length**. Redis stores every key as a full string in memory, wrapped in an SDS structure and allocated by jemalloc. Longer keys (e.g., `namespace:key123`) fall into larger jemalloc size classes, require more bytes for the SDS header, and cause more fragmentation. Shorter keys (e.g., `key123`) fit into much smaller slabs, pack tightly, and result in far more stable and predictable memory usage.
This means the colon is not the issue—**the extra characters are.** A key that goes from ~18 bytes to ~6 bytes can use *half the memory per key* once overhead, allocator classes, and fragmentation are considered. Multiply that by hundreds of thousands or millions of keys, and memory usage becomes significantly smaller and much more stable simply because the keys are shorter.
## How to use Namespaces
You can set a namespace for your keys. This is useful if you want to manage your keys in a more organized way. Here is an example of how to set a `namespace` with the `store` option:

@@ -223,0 +231,0 @@