@mysetup/cache 2.0.1 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/cache.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/package.json +50 -38
- package/dist/cache.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @mysetup/cache
|
|
2
|
+
|
|
3
|
+
Thin wrapper around `node-cache` for in-memory key/value storage.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @mysetup/cache
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Supported libraries and runtimes
|
|
12
|
+
|
|
13
|
+
| Supported | Notes |
|
|
14
|
+
| ---------------------- | ------------------------------------------------------ |
|
|
15
|
+
| Node.js | Full support |
|
|
16
|
+
| Next.js server runtime | Use in route handlers, server actions, or backend code |
|
|
17
|
+
| Vite browser apps | Not supported |
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { setCacheData, getCacheData, deleteCacheData } from "@mysetup/cache";
|
|
23
|
+
|
|
24
|
+
setCacheData("session:user:1", { id: 1 }, 60);
|
|
25
|
+
const session = getCacheData("session:user:1");
|
|
26
|
+
deleteCacheData("session:user:1");
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
|
|
31
|
+
- Cache data is stored in process memory.
|
|
32
|
+
- Do not rely on this package for distributed caching across multiple servers.
|
package/dist/cache.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ declare const setCacheData: (key: string, value: unknown, expiry?: number) => vo
|
|
|
2
2
|
declare const getCacheData: (key: string) => unknown;
|
|
3
3
|
declare const deleteCacheData: (key: string) => number;
|
|
4
4
|
export { setCacheData, getCacheData, deleteCacheData };
|
|
5
|
-
//# sourceMappingURL=cache.d.ts.map
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "@mysetup/cache",
|
|
3
|
+
"version": "2.0.4",
|
|
4
|
+
"description": "Shared in-memory cache helpers built on top of node-cache.",
|
|
5
|
+
"author": "krishnaraj <krishnaraj.webdev@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"cache",
|
|
9
|
+
"node-cache",
|
|
10
|
+
"nodejs",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.js"
|
|
16
27
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
}
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"node-cache": "^5.1.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.13.1",
|
|
35
|
+
"typescript": "5.5.4",
|
|
36
|
+
"@mysetup/prettier-config": "^2.0.4",
|
|
37
|
+
"@mysetup/eslint-config": "^2.0.5",
|
|
38
|
+
"@mysetup/tsconfig": "^2.0.4"
|
|
39
|
+
},
|
|
40
|
+
"prettier": "@mysetup/prettier-config",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.15.1"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"lint": "node ../scripts/run-eslint.cjs .",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"build": "node ../scripts/package-fs.cjs remove dist && tsc",
|
|
48
|
+
"format": "prettier --write \"**/*.{ts,tsx,md,js}\"",
|
|
49
|
+
"checks": "pnpm typecheck && pnpm lint && pnpm build",
|
|
50
|
+
"clean": "node ../scripts/package-fs.cjs remove node_modules .swc dist pnpm-lock.yaml && echo \"Cleaned\""
|
|
51
|
+
}
|
|
52
|
+
}
|
package/dist/cache.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../cache.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,YAAY,QAAS,MAAM,SAAS,OAAO,WAAW,MAAM,SAMjE,CAAC;AAGF,QAAA,MAAM,YAAY,QAAS,MAAM,YAEhC,CAAC;AAGF,QAAA,MAAM,eAAe,QAAS,MAAM,WAEnC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|