@geekmidas/cache 0.0.1
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/dist/__tests__/cache.spec.cjs +76 -0
- package/dist/__tests__/cache.spec.mjs +76 -0
- package/dist/__tests__/integration.spec.cjs +234 -0
- package/dist/__tests__/integration.spec.mjs +234 -0
- package/dist/__tests__/memory.spec.cjs +125 -0
- package/dist/__tests__/memory.spec.mjs +125 -0
- package/dist/__tests__/upstash.spec.cjs +201 -0
- package/dist/__tests__/upstash.spec.mjs +201 -0
- package/dist/cache.cjs +0 -0
- package/dist/cache.mjs +0 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/magic-string.es-BvJNBYzY.mjs +1014 -0
- package/dist/magic-string.es-CKiDiYoS.cjs +1015 -0
- package/dist/memory-YteQXj7m.mjs +16 -0
- package/dist/memory-n6Iosq6J.cjs +22 -0
- package/dist/memory.cjs +3 -0
- package/dist/memory.mjs +3 -0
- package/dist/upstash-Cpe9W0-L.mjs +26 -0
- package/dist/upstash-s7dedvpn.cjs +32 -0
- package/dist/upstash.cjs +3 -0
- package/dist/upstash.mjs +3 -0
- package/dist/vi.DgezovHB-McgltIC5.mjs +13079 -0
- package/dist/vi.DgezovHB-NqP74KGR.cjs +13104 -0
- package/package.json +23 -0
- package/src/__tests__/cache.spec.ts +111 -0
- package/src/__tests__/integration.spec.ts +273 -0
- package/src/__tests__/memory.spec.ts +134 -0
- package/src/__tests__/upstash.spec.ts +247 -0
- package/src/cache.ts +5 -0
- package/src/memory.ts +17 -0
- package/src/upstash.ts +31 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/memory.ts
|
|
2
|
+
var InMemoryCache = class {
|
|
3
|
+
store = /* @__PURE__ */ new Map();
|
|
4
|
+
async get(key) {
|
|
5
|
+
return this.store.get(key);
|
|
6
|
+
}
|
|
7
|
+
async set(key, value) {
|
|
8
|
+
this.store.set(key, value);
|
|
9
|
+
}
|
|
10
|
+
async delete(key) {
|
|
11
|
+
this.store.delete(key);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { InMemoryCache };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/memory.ts
|
|
3
|
+
var InMemoryCache = class {
|
|
4
|
+
store = /* @__PURE__ */ new Map();
|
|
5
|
+
async get(key) {
|
|
6
|
+
return this.store.get(key);
|
|
7
|
+
}
|
|
8
|
+
async set(key, value) {
|
|
9
|
+
this.store.set(key, value);
|
|
10
|
+
}
|
|
11
|
+
async delete(key) {
|
|
12
|
+
this.store.delete(key);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
Object.defineProperty(exports, 'InMemoryCache', {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return InMemoryCache;
|
|
21
|
+
}
|
|
22
|
+
});
|
package/dist/memory.cjs
ADDED
package/dist/memory.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Redis } from "@upstash/redis";
|
|
2
|
+
|
|
3
|
+
//#region src/upstash.ts
|
|
4
|
+
var UpstashCache = class {
|
|
5
|
+
client;
|
|
6
|
+
constructor(url, token) {
|
|
7
|
+
this.client = new Redis({
|
|
8
|
+
url,
|
|
9
|
+
token
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async get(key) {
|
|
13
|
+
const v = await this.client.get(key);
|
|
14
|
+
if (v === null) return void 0;
|
|
15
|
+
return v;
|
|
16
|
+
}
|
|
17
|
+
async set(key, value) {
|
|
18
|
+
await this.client.set(key, value);
|
|
19
|
+
}
|
|
20
|
+
async delete(key) {
|
|
21
|
+
await this.client.del(key);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { UpstashCache };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const __upstash_redis = require_chunk.__toESM(require("@upstash/redis"));
|
|
3
|
+
|
|
4
|
+
//#region src/upstash.ts
|
|
5
|
+
var UpstashCache = class {
|
|
6
|
+
client;
|
|
7
|
+
constructor(url, token) {
|
|
8
|
+
this.client = new __upstash_redis.Redis({
|
|
9
|
+
url,
|
|
10
|
+
token
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async get(key) {
|
|
14
|
+
const v = await this.client.get(key);
|
|
15
|
+
if (v === null) return void 0;
|
|
16
|
+
return v;
|
|
17
|
+
}
|
|
18
|
+
async set(key, value) {
|
|
19
|
+
await this.client.set(key, value);
|
|
20
|
+
}
|
|
21
|
+
async delete(key) {
|
|
22
|
+
await this.client.del(key);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
Object.defineProperty(exports, 'UpstashCache', {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return UpstashCache;
|
|
31
|
+
}
|
|
32
|
+
});
|
package/dist/upstash.cjs
ADDED
package/dist/upstash.mjs
ADDED