@stacksjs/cache 0.57.3 โ 0.58.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/README.md +4 -4
- package/dist/index.js +88 -0
- package/package.json +29 -24
- package/LICENSE.md +0 -21
- package/dist/drivers/dynamodb.d.ts +0 -1
- package/dist/drivers/dynamodb.mjs +0 -1
- package/dist/drivers/index.d.ts +0 -4
- package/dist/drivers/index.mjs +0 -4
- package/dist/drivers/memcached.d.ts +0 -1
- package/dist/drivers/memcached.mjs +0 -1
- package/dist/drivers/redis.d.ts +0 -9
- package/dist/drivers/redis.mjs +0 -29
- package/dist/drivers/upstash.d.ts +0 -1
- package/dist/drivers/upstash.mjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +0 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ wip
|
|
|
15
15
|
wip
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
|
|
18
|
+
bun install -d @stacksjs/cache
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Now, you can use it in your project:
|
|
@@ -31,7 +31,7 @@ Learn more in the docs.
|
|
|
31
31
|
## ๐งช Testing
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
|
|
34
|
+
bun test
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## ๐ Changelog
|
|
@@ -50,10 +50,10 @@ For help, discussion about best practices, or any other conversation that would
|
|
|
50
50
|
|
|
51
51
|
For casual chit-chat with others using this package:
|
|
52
52
|
|
|
53
|
-
[Join the Stacks Discord Server](https://discord.
|
|
53
|
+
[Join the Stacks Discord Server](https://discord.gg/stacksjs)
|
|
54
54
|
|
|
55
55
|
## ๐ License
|
|
56
56
|
|
|
57
57
|
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
|
|
58
58
|
|
|
59
|
-
Made with
|
|
59
|
+
Made with ๐
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
set: (newValue) => all[name] = () => newValue
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/drivers/redis.ts
|
|
14
|
+
var exports_redis = {};
|
|
15
|
+
__export(exports_redis, {
|
|
16
|
+
set: () => {
|
|
17
|
+
{
|
|
18
|
+
return set;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
remove: () => {
|
|
22
|
+
{
|
|
23
|
+
return remove;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
get: () => {
|
|
27
|
+
{
|
|
28
|
+
return get;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
flushDB: () => {
|
|
32
|
+
{
|
|
33
|
+
return flushDB;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
flushAll: () => {
|
|
37
|
+
{
|
|
38
|
+
return flushAll;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
del: () => {
|
|
42
|
+
{
|
|
43
|
+
return del;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
client: () => {
|
|
47
|
+
{
|
|
48
|
+
return client;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
import {cache} from "@stacksjs/config";
|
|
53
|
+
import Redis, {Command} from "ioredis";
|
|
54
|
+
async function set(key, value) {
|
|
55
|
+
await client.set(key, value);
|
|
56
|
+
}
|
|
57
|
+
async function get(key) {
|
|
58
|
+
const value = await client.get(key);
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
async function remove(key) {
|
|
62
|
+
await client.del(key);
|
|
63
|
+
}
|
|
64
|
+
async function del(key) {
|
|
65
|
+
await client.del(key);
|
|
66
|
+
}
|
|
67
|
+
async function flushAll() {
|
|
68
|
+
const command = new Command("FLUSHALL", ["ASYNC"], { replyEncoding: "utf-8" }, () => {
|
|
69
|
+
});
|
|
70
|
+
await client.sendCommand(command);
|
|
71
|
+
}
|
|
72
|
+
async function flushDB() {
|
|
73
|
+
const command = new Command("FLUSHDB", ["ASYNC"], { replyEncoding: "utf-8" }, () => {
|
|
74
|
+
});
|
|
75
|
+
await client.sendCommand(command);
|
|
76
|
+
}
|
|
77
|
+
var client = new Redis({
|
|
78
|
+
host: cache.drivers?.redis?.host,
|
|
79
|
+
port: cache.drivers?.redis?.port,
|
|
80
|
+
username: cache.drivers?.redis?.username,
|
|
81
|
+
password: cache.drivers?.redis?.password
|
|
82
|
+
});
|
|
83
|
+
// src/drivers/dynamodb.ts
|
|
84
|
+
var exports_dynamodb = {};
|
|
85
|
+
export {
|
|
86
|
+
exports_redis as redis,
|
|
87
|
+
exports_dynamodb as dynamodb
|
|
88
|
+
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cache",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"
|
|
6
|
-
"description": "The Stacks way of caching.",
|
|
4
|
+
"version": "0.58.19",
|
|
5
|
+
"description": "Caching the Stacks way.",
|
|
7
6
|
"author": "Chris Breuer",
|
|
8
7
|
"license": "MIT",
|
|
9
8
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
|
-
"homepage": "https://github.com/stacksjs/stacks/tree/main
|
|
9
|
+
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/src/cache#readme",
|
|
11
10
|
"repository": {
|
|
12
11
|
"type": "git",
|
|
13
12
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
14
|
-
"directory": "
|
|
13
|
+
"directory": "./storage/framework/core/src/cache"
|
|
15
14
|
},
|
|
16
15
|
"bugs": {
|
|
17
16
|
"url": "https://github.com/stacksjs/stacks/issues"
|
|
@@ -28,33 +27,39 @@
|
|
|
28
27
|
],
|
|
29
28
|
"exports": {
|
|
30
29
|
".": {
|
|
31
|
-
"
|
|
32
|
-
"import": "./dist/index.
|
|
30
|
+
"bun": "./src/index.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./*": {
|
|
34
|
+
"bun": "./src/*",
|
|
35
|
+
"import": "./dist/*"
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
|
-
"module": "dist/index.
|
|
38
|
+
"module": "dist/index.js",
|
|
36
39
|
"types": "dist/index.d.ts",
|
|
37
40
|
"contributors": [
|
|
38
|
-
"Chris Breuer <chris@
|
|
41
|
+
"Chris Breuer <chris@stacksjs.org>"
|
|
39
42
|
],
|
|
40
43
|
"files": [
|
|
41
|
-
"
|
|
42
|
-
"
|
|
44
|
+
"README.md",
|
|
45
|
+
"dist"
|
|
43
46
|
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "bun --bun build.ts",
|
|
49
|
+
"typecheck": "bun --bun tsc --noEmit",
|
|
50
|
+
"prepublishOnly": "bun --bun run build"
|
|
51
|
+
},
|
|
44
52
|
"peerDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@types/memjs": "^1.3.0",
|
|
47
|
-
"memcached": "^2.2.2",
|
|
48
|
-
"memjs": "^1.3.1",
|
|
49
|
-
"redis": "^4.6.7",
|
|
50
|
-
"@stacksjs/config": "0.57.3"
|
|
53
|
+
"@stacksjs/config": "workspace:*"
|
|
51
54
|
},
|
|
52
|
-
"
|
|
53
|
-
"@stacksjs/
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@stacksjs/config": "workspace:*"
|
|
54
57
|
},
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
58
|
+
"optionalDependencies": {
|
|
59
|
+
"@aws-sdk/client-dynamodb": "^3.490.0",
|
|
60
|
+
"ioredis": "^5.3.2"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@stacksjs/development": "workspace:*"
|
|
59
64
|
}
|
|
60
|
-
}
|
|
65
|
+
}
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Open Web Foundation
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/drivers/index.d.ts
DELETED
package/dist/drivers/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/drivers/redis.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RedisClientType } from 'redis';
|
|
2
|
-
declare const client: RedisClientType;
|
|
3
|
-
declare function set(key: string, value: any): Promise<void>;
|
|
4
|
-
declare function get(key: string): Promise<any>;
|
|
5
|
-
declare function remove(key: string): Promise<void>;
|
|
6
|
-
declare function del(key: string): Promise<void>;
|
|
7
|
-
declare function flushAll(): Promise<void>;
|
|
8
|
-
declare function flushDB(): Promise<void>;
|
|
9
|
-
export { set, get, remove, del, flushAll, flushDB, client };
|
package/dist/drivers/redis.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createClient } from "redis";
|
|
2
|
-
import { cache } from "@stacksjs/config";
|
|
3
|
-
const client = createClient({
|
|
4
|
-
socket: {
|
|
5
|
-
host: cache.drivers?.redis?.host,
|
|
6
|
-
port: cache.drivers?.redis?.port
|
|
7
|
-
},
|
|
8
|
-
password: ""
|
|
9
|
-
});
|
|
10
|
-
async function set(key, value) {
|
|
11
|
-
await client.set(key, value);
|
|
12
|
-
}
|
|
13
|
-
async function get(key) {
|
|
14
|
-
const value = await client.get(key);
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
async function remove(key) {
|
|
18
|
-
await client.del(key);
|
|
19
|
-
}
|
|
20
|
-
async function del(key) {
|
|
21
|
-
await client.del(key);
|
|
22
|
-
}
|
|
23
|
-
async function flushAll() {
|
|
24
|
-
await client.sendCommand(["FLUSHALL", "ASYNC"]);
|
|
25
|
-
}
|
|
26
|
-
async function flushDB() {
|
|
27
|
-
await client.sendCommand(["FLUSHDB", "ASYNC"]);
|
|
28
|
-
}
|
|
29
|
-
export { set, get, remove, del, flushAll, flushDB, client };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/drivers/upstash.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './drivers';
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./drivers/index.mjs";
|