You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@cacheable/node-cache

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cacheable/node-cache - npm Package Compare versions

Comparing version

to
1.5.8

7

dist/index.d.ts

@@ -157,3 +157,8 @@ import { Hookified } from 'hookified';

/**
* Clones the returned items via get functions. Default is true.
* If set to true (Default Setting), the cache will clone the returned items via get() functions.
* This means that every time you set a value into the cache, node-cache makes a deep clone of it.
* When you get that value back, you receive another deep clone.
* This mimics the behavior of an external cache like Redis or Memcached, meaning mutations to the
* returned object do not affect the cached copy (and vice versa). If set to false, the original
* object will be returned, and mutations will affect the cached copy.
*/

@@ -160,0 +165,0 @@ useClones?: boolean;

18

package.json
{
"name": "@cacheable/node-cache",
"version": "1.5.7",
"version": "1.5.8",
"description": "Simple and Maintained fast NodeJS internal caching",

@@ -35,14 +35,14 @@ "type": "module",

"@types/eslint": "^9.6.1",
"@types/node": "^22.15.30",
"@vitest/coverage-v8": "^3.2.2",
"@types/node": "^24.0.7",
"@vitest/coverage-v8": "^3.2.4",
"rimraf": "^6.0.1",
"tsup": "^8.5.0",
"typescript": "^5.8.3",
"vitest": "^3.2.2",
"xo": "^1.1.0"
"vitest": "^3.2.4",
"xo": "^1.1.1"
},
"dependencies": {
"hookified": "^1.9.1",
"keyv": "^5.3.3",
"cacheable": "^1.10.0"
"hookified": "^1.10.0",
"keyv": "^5.3.4",
"cacheable": "^1.10.1"
},

@@ -57,5 +57,5 @@ "files": [

"test": "xo --fix && vitest run --coverage",
"test:ci": "xo && vitest run",
"test:ci": "xo && vitest run --coverage",
"clean": "rimraf ./dist ./coverage ./node_modules"
}
}

@@ -80,10 +80,20 @@ [<img align="center" src="https://cacheable.org/symbol.svg" alt="Cacheable" />](https://github.com/jaredwray/cacheable)

export type NodeCacheOptions = {
stdTTL?: number; // The standard ttl as number in seconds for every generated cache element. 0 = unlimited. If string, it will be parsed as shorthand and default to milliseconds if it is a number as a string.
checkperiod?: number; // Default is 600, 0 means no periodic check
useClones?: boolean; // Default is true
deleteOnExpire?: boolean; // Default is true, if false it will keep the key and not delete during an interval check and the value on get() will be undefined
maxKeys?: number; // Default is -1 (unlimited). If this is set it will throw and error if you try to set more keys than the max.
stdTTL?: number;
checkperiod?: number;
useClones?: boolean;
deleteOnExpire?: boolean;
maxKeys?: number;
};
```
Here is a description of the options:
| Option | Default Setting | Description |
|--------|----------------|-------------|
| `stdTTL` | `0` | The standard time to live (TTL) in seconds for every generated cache element. If set to `0`, it means unlimited. If a string is provided, it will be parsed as shorthand and default to milliseconds if it is a number as a string. |
| `checkperiod` | `600` | The interval in seconds to check for expired keys. If set to `0`, it means no periodic check will be performed. |
| `useClones` | `true` | If set to `true`, the cache will clone the returned items via `get()` functions. This means that every time you set a value into the cache, `node-cache` makes a deep clone of it. When you get that value back, you receive another deep clone. This mimics the behavior of an external cache like Redis or Memcached, meaning mutations to the returned object do not affect the cached copy (and vice versa). If set to `false`, the original object will be returned, and mutations will affect the cached copy. |
| `deleteOnExpire` | `true` | If set to `true`, the key will be deleted when it expires. If set to `false`, the key will remain in the cache, but the value returned by `get()` will be `undefined`. You can manage the key with the `on('expired')` event. |
| `maxKeys` | `-1` | If set to a positive number, it will limit the number of keys in the cache. If the number of keys exceeds this limit, it will throw an error when trying to set more keys than the maximum. If set to `-1`, it means unlimited keys are allowed. |
When initializing the cache you can pass in the options to set the configuration like the example below where we set the `stdTTL` to 10 seconds and `checkperiod` to 5 seconds.:

@@ -90,0 +100,0 @@

Sorry, the diff of this file is not supported yet