@bejibun/cache 0.1.18 → 0.1.19
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/CHANGELOG.md +32 -17
- package/LICENSE +1 -1
- package/README.md +7 -7
- package/builders/CacheBuilder.js +21 -21
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,21 +3,36 @@ All notable changes to this project will be documented in this file.
|
|
|
3
3
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
## [v0.1.
|
|
6
|
+
## [v0.1.19](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.16...v0.1.19) - 2026-03-02
|
|
7
7
|
|
|
8
8
|
### 🩹 Fixes
|
|
9
|
-
- Something went wrong when processing cache file with TTL - [#2](https://github.com/crenata/bejibun-cache/issues/2)
|
|
10
9
|
|
|
11
10
|
### 📖 Changes
|
|
11
|
+
#### Upgrade [@bejibun/redis](https://github.com/Bejibun-Framework/bejibun-redis) to v0.1.39
|
|
12
|
+
[https://github.com/Bejibun-Framework/bejibun-redis/releases/tag/v0.1.39](https://github.com/Bejibun-Framework/bejibun-redis/releases/tag/v0.1.39)
|
|
12
13
|
|
|
13
14
|
### ❤️Contributors
|
|
14
15
|
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
15
16
|
|
|
16
|
-
**Full Changelog**: https://github.com/
|
|
17
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
20
|
-
## [v0.1.
|
|
21
|
+
## [v0.1.16](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.15...v0.1.16) - 2025-12-15
|
|
22
|
+
|
|
23
|
+
### 🩹 Fixes
|
|
24
|
+
- Something went wrong when processing cache file with TTL - [#2](https://github.com/Bejibun-Framework/bejibun-cache/issues/2)
|
|
25
|
+
|
|
26
|
+
### 📖 Changes
|
|
27
|
+
|
|
28
|
+
### ❤️Contributors
|
|
29
|
+
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
30
|
+
|
|
31
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [v0.1.15](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.14...v0.1.15) - 2025-12-14
|
|
21
36
|
|
|
22
37
|
### 🩹 Fixes
|
|
23
38
|
|
|
@@ -55,14 +70,14 @@ connections: {
|
|
|
55
70
|
### ❤️Contributors
|
|
56
71
|
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
57
72
|
|
|
58
|
-
**Full Changelog**: https://github.com/
|
|
73
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
59
74
|
|
|
60
75
|
---
|
|
61
76
|
|
|
62
|
-
## [v0.1.14](https://github.com/
|
|
77
|
+
## [v0.1.14](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.12...v0.1.14) - 2025-12-12
|
|
63
78
|
|
|
64
79
|
### 🩹 Fixes
|
|
65
|
-
- Redis connection with Cache own configuration - [#1](https://github.com/
|
|
80
|
+
- Redis connection with Cache own configuration - [#1](https://github.com/Bejibun-Framework/bejibun-core/issues/1)
|
|
66
81
|
|
|
67
82
|
### 📖 Changes
|
|
68
83
|
What's New :
|
|
@@ -81,11 +96,11 @@ If so, the data is returned. Otherwise, the cache file will be deleted and retur
|
|
|
81
96
|
### ❤️Contributors
|
|
82
97
|
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
83
98
|
|
|
84
|
-
**Full Changelog**: https://github.com/
|
|
99
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
85
100
|
|
|
86
101
|
---
|
|
87
102
|
|
|
88
|
-
## [v0.1.12](https://github.com/
|
|
103
|
+
## [v0.1.12](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.11...v0.1.12) - 2025-12-04
|
|
89
104
|
|
|
90
105
|
### 🩹 Fixes
|
|
91
106
|
|
|
@@ -93,16 +108,16 @@ If so, the data is returned. Otherwise, the cache file will be deleted and retur
|
|
|
93
108
|
What's New :
|
|
94
109
|
- Adding `local` connection for file schema
|
|
95
110
|
|
|
96
|
-
Now, [@bejibun/cache](https://github.com/
|
|
111
|
+
Now, [@bejibun/cache](https://github.com/Bejibun-Framework/bejibun-cache) has local and redis for cache system.
|
|
97
112
|
|
|
98
113
|
### ❤️Contributors
|
|
99
114
|
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
100
115
|
|
|
101
|
-
**Full Changelog**: https://github.com/
|
|
116
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
102
117
|
|
|
103
118
|
---
|
|
104
119
|
|
|
105
|
-
## [v0.1.11](https://github.com/
|
|
120
|
+
## [v0.1.11](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.0...v0.1.11) - 2025-11-23
|
|
106
121
|
|
|
107
122
|
### 🩹 Fixes
|
|
108
123
|
|
|
@@ -113,11 +128,11 @@ What's New :
|
|
|
113
128
|
### ❤️Contributors
|
|
114
129
|
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
115
130
|
|
|
116
|
-
**Full Changelog**: https://github.com/
|
|
131
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
117
132
|
|
|
118
133
|
---
|
|
119
134
|
|
|
120
|
-
## [v0.1.1](https://github.com/
|
|
135
|
+
## [v0.1.1](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.0...v0.1.1) - 2025-11-23
|
|
121
136
|
|
|
122
137
|
### 🩹 Fixes
|
|
123
138
|
|
|
@@ -130,11 +145,11 @@ What's New :
|
|
|
130
145
|
### ❤️Contributors
|
|
131
146
|
- Ghulje ([@ghulje](https://github.com/ghulje))
|
|
132
147
|
|
|
133
|
-
**Full Changelog**: https://github.com/
|
|
148
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
|
134
149
|
|
|
135
150
|
---
|
|
136
151
|
|
|
137
|
-
## [v0.1.0](https://github.com/
|
|
152
|
+
## [v0.1.0](https://github.com/Bejibun-Framework/bejibun-cache/compare/v0.1.0...v0.1.0) - 2025-11-09
|
|
138
153
|
|
|
139
154
|
### 🩹 Fixes
|
|
140
155
|
|
|
@@ -152,4 +167,4 @@ Cache with Redis, currently only redis.
|
|
|
152
167
|
### ❤️Contributors
|
|
153
168
|
- Havea Crenata ([@crenata](https://github.com/crenata))
|
|
154
169
|
|
|
155
|
-
**Full Changelog**: https://github.com/
|
|
170
|
+
**Full Changelog**: https://github.com/Bejibun-Framework/bejibun-cache/blob/master/CHANGELOG.md
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="https://github.com/
|
|
3
|
+
<img src="https://github.com/Bejibun-Framework/bejibun/blob/master/public/images/bejibun.png?raw=true" width="150" alt="Bejibun" />
|
|
4
4
|
|
|
5
|
-
](https://img.shields.io/github/v/release/
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
10
|
|
|
11
11
|
</div>
|
|
12
12
|
|
|
@@ -91,7 +91,7 @@ If you find this project helpful and want to support it, you can donate via cryp
|
|
|
91
91
|
|
|
92
92
|
| EVM | Solana |
|
|
93
93
|
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
94
|
-
| <img src="https://github.com/
|
|
94
|
+
| <img src="https://github.com/Bejibun-Framework/bejibun/blob/master/public/images/EVM.png?raw=true" width="150" /> | <img src="https://github.com/Bejibun-Framework/bejibun/blob/master/public/images/SOL.png?raw=true" width="150" /> |
|
|
95
95
|
| 0xdABe8750061410D35cE52EB2a418c8cB004788B3 | GAnoyvy9p3QFyxikWDh9hA3fmSk2uiPLNWyQ579cckMn |
|
|
96
96
|
|
|
97
97
|
Or you can buy this `$BJBN (Bejibun)` tokens [here](https://pump.fun/coin/CQhbNnCGKfDaKXt8uE61i5DrBYJV7NPsCDD9vQgypump), beware of bots.
|
package/builders/CacheBuilder.js
CHANGED
|
@@ -7,8 +7,8 @@ import Enum from "@bejibun/utils/facades/Enum";
|
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import path from "path";
|
|
9
9
|
import CacheConfig from "../config/cache";
|
|
10
|
-
import CacheException from "../exceptions/CacheException";
|
|
11
10
|
import CacheDriverEnum from "../enums/CacheDriverEnum";
|
|
11
|
+
import CacheException from "../exceptions/CacheException";
|
|
12
12
|
export default class CacheBuilder {
|
|
13
13
|
conf;
|
|
14
14
|
conn;
|
|
@@ -51,11 +51,11 @@ export default class CacheBuilder {
|
|
|
51
51
|
if (!Enum.setEnums(CacheDriverEnum).hasValue(driver))
|
|
52
52
|
throw new CacheException(`Not supported "driver" cache.`);
|
|
53
53
|
switch (driver) {
|
|
54
|
-
case
|
|
54
|
+
case CacheDriverEnum.Local:
|
|
55
55
|
if (isEmpty(this.currentConnection?.path))
|
|
56
56
|
throw new CacheException(`Missing "path" for "local" cache configuration.`);
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case CacheDriverEnum.Redis:
|
|
59
59
|
if (isEmpty(this.currentConnection?.host))
|
|
60
60
|
throw new CacheException(`Missing "host" for "redis" cache configuration.`);
|
|
61
61
|
if (isEmpty(this.currentConnection?.port))
|
|
@@ -118,7 +118,7 @@ export default class CacheBuilder {
|
|
|
118
118
|
async remember(key, callback, ttl) {
|
|
119
119
|
let data;
|
|
120
120
|
switch (this.driver) {
|
|
121
|
-
case
|
|
121
|
+
case CacheDriverEnum.Local:
|
|
122
122
|
const raw = await this.getFile(key);
|
|
123
123
|
data = raw.data;
|
|
124
124
|
if (isEmpty(data)) {
|
|
@@ -126,7 +126,7 @@ export default class CacheBuilder {
|
|
|
126
126
|
await this.setFile(key, data, ttl);
|
|
127
127
|
}
|
|
128
128
|
break;
|
|
129
|
-
case
|
|
129
|
+
case CacheDriverEnum.Redis:
|
|
130
130
|
data = await this.redis.get(this.key(key));
|
|
131
131
|
if (isEmpty(data)) {
|
|
132
132
|
data = callback();
|
|
@@ -142,11 +142,11 @@ export default class CacheBuilder {
|
|
|
142
142
|
async has(key) {
|
|
143
143
|
let data;
|
|
144
144
|
switch (this.driver) {
|
|
145
|
-
case
|
|
145
|
+
case CacheDriverEnum.Local:
|
|
146
146
|
const raw = await this.getFile(key);
|
|
147
147
|
data = raw.data;
|
|
148
148
|
break;
|
|
149
|
-
case
|
|
149
|
+
case CacheDriverEnum.Redis:
|
|
150
150
|
data = await this.redis.get(this.key(key));
|
|
151
151
|
break;
|
|
152
152
|
default:
|
|
@@ -158,11 +158,11 @@ export default class CacheBuilder {
|
|
|
158
158
|
async get(key) {
|
|
159
159
|
let data;
|
|
160
160
|
switch (this.driver) {
|
|
161
|
-
case
|
|
161
|
+
case CacheDriverEnum.Local:
|
|
162
162
|
const raw = await this.getFile(key);
|
|
163
163
|
data = raw.data;
|
|
164
164
|
break;
|
|
165
|
-
case
|
|
165
|
+
case CacheDriverEnum.Redis:
|
|
166
166
|
data = await this.redis.get(this.key(key));
|
|
167
167
|
break;
|
|
168
168
|
default:
|
|
@@ -176,11 +176,11 @@ export default class CacheBuilder {
|
|
|
176
176
|
let data;
|
|
177
177
|
try {
|
|
178
178
|
switch (this.driver) {
|
|
179
|
-
case
|
|
179
|
+
case CacheDriverEnum.Local:
|
|
180
180
|
const raw = await this.getFile(key);
|
|
181
181
|
data = raw.data;
|
|
182
182
|
break;
|
|
183
|
-
case
|
|
183
|
+
case CacheDriverEnum.Redis:
|
|
184
184
|
data = await this.redis.get(this.key(key));
|
|
185
185
|
break;
|
|
186
186
|
default:
|
|
@@ -189,10 +189,10 @@ export default class CacheBuilder {
|
|
|
189
189
|
}
|
|
190
190
|
if (isEmpty(data)) {
|
|
191
191
|
switch (this.driver) {
|
|
192
|
-
case
|
|
192
|
+
case CacheDriverEnum.Local:
|
|
193
193
|
await this.setFile(key, value, ttl);
|
|
194
194
|
break;
|
|
195
|
-
case
|
|
195
|
+
case CacheDriverEnum.Redis:
|
|
196
196
|
await this.redis.set(this.key(key), value, ttl);
|
|
197
197
|
break;
|
|
198
198
|
default:
|
|
@@ -214,10 +214,10 @@ export default class CacheBuilder {
|
|
|
214
214
|
let status = true;
|
|
215
215
|
try {
|
|
216
216
|
switch (this.driver) {
|
|
217
|
-
case
|
|
217
|
+
case CacheDriverEnum.Local:
|
|
218
218
|
await this.setFile(key, value, ttl);
|
|
219
219
|
break;
|
|
220
|
-
case
|
|
220
|
+
case CacheDriverEnum.Redis:
|
|
221
221
|
await this.redis.set(this.key(key), value, ttl);
|
|
222
222
|
break;
|
|
223
223
|
default:
|
|
@@ -232,7 +232,7 @@ export default class CacheBuilder {
|
|
|
232
232
|
}
|
|
233
233
|
async forget(key) {
|
|
234
234
|
switch (this.driver) {
|
|
235
|
-
case
|
|
235
|
+
case CacheDriverEnum.Local:
|
|
236
236
|
try {
|
|
237
237
|
await this.file(key).delete();
|
|
238
238
|
}
|
|
@@ -240,7 +240,7 @@ export default class CacheBuilder {
|
|
|
240
240
|
break;
|
|
241
241
|
}
|
|
242
242
|
break;
|
|
243
|
-
case
|
|
243
|
+
case CacheDriverEnum.Redis:
|
|
244
244
|
await this.redis.del(this.key(key));
|
|
245
245
|
break;
|
|
246
246
|
default:
|
|
@@ -250,7 +250,7 @@ export default class CacheBuilder {
|
|
|
250
250
|
async increment(key, ttl) {
|
|
251
251
|
let data;
|
|
252
252
|
switch (this.driver) {
|
|
253
|
-
case
|
|
253
|
+
case CacheDriverEnum.Local:
|
|
254
254
|
const raw = await this.getFile(key);
|
|
255
255
|
data = Number(raw.data);
|
|
256
256
|
if (isEmpty(data)) {
|
|
@@ -262,7 +262,7 @@ export default class CacheBuilder {
|
|
|
262
262
|
await this.setFile(key, String(data), ttl);
|
|
263
263
|
}
|
|
264
264
|
break;
|
|
265
|
-
case
|
|
265
|
+
case CacheDriverEnum.Redis:
|
|
266
266
|
data = Number(await this.redis.get(this.key(key)));
|
|
267
267
|
if (isEmpty(data)) {
|
|
268
268
|
data = 1;
|
|
@@ -282,7 +282,7 @@ export default class CacheBuilder {
|
|
|
282
282
|
async decrement(key, ttl) {
|
|
283
283
|
let data;
|
|
284
284
|
switch (this.driver) {
|
|
285
|
-
case
|
|
285
|
+
case CacheDriverEnum.Local:
|
|
286
286
|
const raw = await this.getFile(key);
|
|
287
287
|
data = Number(raw.data);
|
|
288
288
|
if (isEmpty(data)) {
|
|
@@ -294,7 +294,7 @@ export default class CacheBuilder {
|
|
|
294
294
|
await this.setFile(key, String(data), ttl);
|
|
295
295
|
}
|
|
296
296
|
break;
|
|
297
|
-
case
|
|
297
|
+
case CacheDriverEnum.Redis:
|
|
298
298
|
data = Number(await this.redis.get(this.key(key)));
|
|
299
299
|
if (isEmpty(data)) {
|
|
300
300
|
data = -1;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bejibun/cache",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"author": "Havea Crenata <havea.crenata@gmail.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/Bejibun-Framework/bejibun-cache.git"
|
|
8
8
|
},
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"module": "index.js",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"tsc-alias": "^1.8.16"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/Bejibun-Framework/bejibun-cache/issues"
|
|
17
17
|
},
|
|
18
18
|
"description": "Cache for Bejibun Framework",
|
|
19
|
-
"homepage": "https://github.com/
|
|
19
|
+
"homepage": "https://github.com/Bejibun-Framework/bejibun-cache#readme",
|
|
20
20
|
"keywords": [
|
|
21
21
|
"bun",
|
|
22
22
|
"bun framework",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"type": "module",
|
|
36
36
|
"types": "index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@bejibun/app": "^0.1.
|
|
38
|
+
"@bejibun/app": "^0.1.23",
|
|
39
39
|
"@bejibun/logger": "^0.1.22",
|
|
40
|
-
"@bejibun/redis": "^0.1.
|
|
40
|
+
"@bejibun/redis": "^0.1.39",
|
|
41
41
|
"@bejibun/utils": "^0.1.28"
|
|
42
42
|
}
|
|
43
43
|
}
|