@edirect/redis 11.0.48 → 11.0.49
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 +21 -21
- package/dist/README.md +21 -21
- package/dist/package.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -69,35 +69,35 @@ export class CacheService {
|
|
|
69
69
|
|
|
70
70
|
## Environment Variables
|
|
71
71
|
|
|
72
|
-
| Variable
|
|
73
|
-
|
|
74
|
-
| `REDIS_URL` | Redis connection URL (e.g., `redis://localhost:6379`)
|
|
75
|
-
| `REDIS_TTL` | Default TTL in seconds when `ttl` param is omitted (use `0` for no TTL) | No
|
|
72
|
+
| Variable | Description | Required |
|
|
73
|
+
| ----------- | ----------------------------------------------------------------------- | -------- |
|
|
74
|
+
| `REDIS_URL` | Redis connection URL (e.g., `redis://localhost:6379`) | Yes |
|
|
75
|
+
| `REDIS_TTL` | Default TTL in seconds when `ttl` param is omitted (use `0` for no TTL) | No |
|
|
76
76
|
|
|
77
77
|
## API
|
|
78
78
|
|
|
79
79
|
### `RedisService`
|
|
80
80
|
|
|
81
|
-
| Method
|
|
82
|
-
|
|
83
|
-
| `get`
|
|
84
|
-
| `mget`
|
|
85
|
-
| `set`
|
|
86
|
-
| `del`
|
|
87
|
-
| `setnx`
|
|
88
|
-
| `hget`
|
|
89
|
-
| `hgetall`
|
|
90
|
-
| `keys`
|
|
91
|
-
| `asyncPing` | `(): Promise<boolean>`
|
|
81
|
+
| Method | Signature | Description |
|
|
82
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
83
|
+
| `get` | `(key: string): Promise<string \| object \| null>` | Get and JSON-parse a value by key |
|
|
84
|
+
| `mget` | `(keys: string[]): Promise<string[] \| object[]>` | Get and JSON-parse multiple keys |
|
|
85
|
+
| `set` | `(key: string, data: object \| string, ttl?: number, ttlType?: 'EX' \| 'PX' \| 'EXAT' \| 'PXAT'): Promise<void>` | Set a value with optional TTL. Falls back to `REDIS_TTL` env. |
|
|
86
|
+
| `del` | `(key: string): Promise<void>` | Delete a key |
|
|
87
|
+
| `setnx` | `(key: string, data: object \| string): Promise<boolean>` | Set only if the key does not exist. Returns `true` if set. |
|
|
88
|
+
| `hget` | `(hash: string, field: string): Promise<string \| null>` | Get a single field from a hash |
|
|
89
|
+
| `hgetall` | `(hash: string): Promise<{ [key: string]: string }>` | Get all fields from a hash |
|
|
90
|
+
| `keys` | `(pattern: string): Promise<string \| string[]>` | Find keys matching a pattern |
|
|
91
|
+
| `asyncPing` | `(): Promise<boolean>` | Returns `true` if Redis responds to PING |
|
|
92
92
|
|
|
93
93
|
### TTL Types
|
|
94
94
|
|
|
95
|
-
| `ttlType`
|
|
96
|
-
|
|
97
|
-
| `EX` (default) | Seconds from now
|
|
98
|
-
| `PX`
|
|
99
|
-
| `EXAT`
|
|
100
|
-
| `PXAT`
|
|
95
|
+
| `ttlType` | Description |
|
|
96
|
+
| -------------- | ------------------------------ |
|
|
97
|
+
| `EX` (default) | Seconds from now |
|
|
98
|
+
| `PX` | Milliseconds from now |
|
|
99
|
+
| `EXAT` | Unix timestamp in seconds |
|
|
100
|
+
| `PXAT` | Unix timestamp in milliseconds |
|
|
101
101
|
|
|
102
102
|
## Examples
|
|
103
103
|
|
package/dist/README.md
CHANGED
|
@@ -69,35 +69,35 @@ export class CacheService {
|
|
|
69
69
|
|
|
70
70
|
## Environment Variables
|
|
71
71
|
|
|
72
|
-
| Variable
|
|
73
|
-
|
|
74
|
-
| `REDIS_URL` | Redis connection URL (e.g., `redis://localhost:6379`)
|
|
75
|
-
| `REDIS_TTL` | Default TTL in seconds when `ttl` param is omitted (use `0` for no TTL) | No
|
|
72
|
+
| Variable | Description | Required |
|
|
73
|
+
| ----------- | ----------------------------------------------------------------------- | -------- |
|
|
74
|
+
| `REDIS_URL` | Redis connection URL (e.g., `redis://localhost:6379`) | Yes |
|
|
75
|
+
| `REDIS_TTL` | Default TTL in seconds when `ttl` param is omitted (use `0` for no TTL) | No |
|
|
76
76
|
|
|
77
77
|
## API
|
|
78
78
|
|
|
79
79
|
### `RedisService`
|
|
80
80
|
|
|
81
|
-
| Method
|
|
82
|
-
|
|
83
|
-
| `get`
|
|
84
|
-
| `mget`
|
|
85
|
-
| `set`
|
|
86
|
-
| `del`
|
|
87
|
-
| `setnx`
|
|
88
|
-
| `hget`
|
|
89
|
-
| `hgetall`
|
|
90
|
-
| `keys`
|
|
91
|
-
| `asyncPing` | `(): Promise<boolean>`
|
|
81
|
+
| Method | Signature | Description |
|
|
82
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
83
|
+
| `get` | `(key: string): Promise<string \| object \| null>` | Get and JSON-parse a value by key |
|
|
84
|
+
| `mget` | `(keys: string[]): Promise<string[] \| object[]>` | Get and JSON-parse multiple keys |
|
|
85
|
+
| `set` | `(key: string, data: object \| string, ttl?: number, ttlType?: 'EX' \| 'PX' \| 'EXAT' \| 'PXAT'): Promise<void>` | Set a value with optional TTL. Falls back to `REDIS_TTL` env. |
|
|
86
|
+
| `del` | `(key: string): Promise<void>` | Delete a key |
|
|
87
|
+
| `setnx` | `(key: string, data: object \| string): Promise<boolean>` | Set only if the key does not exist. Returns `true` if set. |
|
|
88
|
+
| `hget` | `(hash: string, field: string): Promise<string \| null>` | Get a single field from a hash |
|
|
89
|
+
| `hgetall` | `(hash: string): Promise<{ [key: string]: string }>` | Get all fields from a hash |
|
|
90
|
+
| `keys` | `(pattern: string): Promise<string \| string[]>` | Find keys matching a pattern |
|
|
91
|
+
| `asyncPing` | `(): Promise<boolean>` | Returns `true` if Redis responds to PING |
|
|
92
92
|
|
|
93
93
|
### TTL Types
|
|
94
94
|
|
|
95
|
-
| `ttlType`
|
|
96
|
-
|
|
97
|
-
| `EX` (default) | Seconds from now
|
|
98
|
-
| `PX`
|
|
99
|
-
| `EXAT`
|
|
100
|
-
| `PXAT`
|
|
95
|
+
| `ttlType` | Description |
|
|
96
|
+
| -------------- | ------------------------------ |
|
|
97
|
+
| `EX` (default) | Seconds from now |
|
|
98
|
+
| `PX` | Milliseconds from now |
|
|
99
|
+
| `EXAT` | Unix timestamp in seconds |
|
|
100
|
+
| `PXAT` | Unix timestamp in milliseconds |
|
|
101
101
|
|
|
102
102
|
## Examples
|
|
103
103
|
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edirect/redis",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.49",
|
|
4
4
|
"packageScope": "@edirect",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@nestjs/common": "^11.1.
|
|
20
|
+
"@nestjs/common": "^11.1.16",
|
|
21
21
|
"redis": "^5.11.0",
|
|
22
22
|
"tslib": "^2.8.1",
|
|
23
|
-
"@edirect/config": "11.0.
|
|
24
|
-
"@edirect/logger": "11.0.
|
|
23
|
+
"@edirect/config": "11.0.49",
|
|
24
|
+
"@edirect/logger": "11.0.49"
|
|
25
25
|
},
|
|
26
26
|
"nx": {
|
|
27
27
|
"name": "@edirect/redis",
|