@stacksjs/cache 0.59.11 → 0.61.0

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/index.js CHANGED
@@ -1,88 +1,6 @@
1
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
2
  // src/drivers/dynamodb.ts
84
3
  var exports_dynamodb = {};
85
4
  export {
86
- exports_redis as redis,
87
5
  exports_dynamodb as dynamodb
88
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/cache",
3
3
  "type": "module",
4
- "version": "0.59.11",
4
+ "version": "0.61.0",
5
5
  "description": "Caching the Stacks way.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -18,8 +18,6 @@
18
18
  "keywords": [
19
19
  "cache",
20
20
  "serverless",
21
- "redis",
22
- "upstash",
23
21
  "dynamodb",
24
22
  "utilities",
25
23
  "functions",
@@ -51,15 +49,13 @@
51
49
  "prepublishOnly": "bun run build"
52
50
  },
53
51
  "peerDependencies": {
52
+ "@aws-sdk/client-dynamodb": "^3.577.0",
54
53
  "@stacksjs/config": "latest"
55
54
  },
56
55
  "dependencies": {
56
+ "@aws-sdk/client-dynamodb": "^3.577.0",
57
57
  "@stacksjs/config": "latest"
58
58
  },
59
- "optionalDependencies": {
60
- "@aws-sdk/client-dynamodb": "^3.528.0",
61
- "ioredis": "^5.3.2"
62
- },
63
59
  "devDependencies": {
64
60
  "@stacksjs/development": "latest"
65
61
  }
@@ -1,4 +1,4 @@
1
- export {}
1
+ export type {}
2
2
 
3
3
  // import type { PutItemCommandInput } from '@aws-sdk/client-dynamodb'
4
4
  // import { DynamoDB, ListTablesCommand } from '@aws-sdk/client-dynamodb'
@@ -1,2 +1 @@
1
- export * as redis from './redis'
2
1
  export * as dynamodb from './dynamodb'
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * as redis from './redis';
2
- export * as dynamodb from './dynamodb';
@@ -1,8 +0,0 @@
1
- import Redis from 'ioredis';
2
- export declare const client: Redis;
3
- export declare function set(key: string, value: any): Promise<void>;
4
- export declare function get(key: string): Promise<any>;
5
- export declare function remove(key: string): Promise<void>;
6
- export declare function del(key: string): Promise<void>;
7
- export declare function flushAll(): Promise<void>;
8
- export declare function flushDB(): Promise<void>;
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './drivers';
@@ -1,37 +0,0 @@
1
- import { cache } from '@stacksjs/config'
2
- import Redis, { Command } from 'ioredis'
3
-
4
- export const client = new Redis({
5
- host: cache.drivers?.redis?.host,
6
- port: cache.drivers?.redis?.port,
7
- username: cache.drivers?.redis?.username,
8
- password: cache.drivers?.redis?.password,
9
- })
10
-
11
- export async function set(key: string, value: any): Promise<void> {
12
- await client.set(key, value)
13
- }
14
-
15
- export async function get(key: string): Promise<any> {
16
- const value = await client.get(key)
17
-
18
- return value
19
- }
20
-
21
- export async function remove(key: string): Promise<void> {
22
- await client.del(key)
23
- }
24
-
25
- export async function del(key: string): Promise<void> {
26
- await client.del(key)
27
- }
28
-
29
- export async function flushAll(): Promise<void> {
30
- const command = new Command('FLUSHALL', ['ASYNC'], { replyEncoding: 'utf-8' }, () => {})
31
- await client.sendCommand(command)
32
- }
33
-
34
- export async function flushDB(): Promise<void> {
35
- const command = new Command('FLUSHDB', ['ASYNC'], { replyEncoding: 'utf-8' }, () => {})
36
- await client.sendCommand(command)
37
- }