corebasic 1.0.155 → 1.0.157

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.
Files changed (2) hide show
  1. package/libs/messaging.js +12 -0
  2. package/package.json +1 -1
package/libs/messaging.js CHANGED
@@ -128,6 +128,18 @@ export async function del(key) {
128
128
  await defaultSetGetConsumer.del(`${process.env.REDIS_CHANNEL_PREFIX}_${key}`)
129
129
  }
130
130
 
131
+ export async function hset(key, subkey, value) {
132
+ await defaultSetGetConsumer.hset(`${process.env.REDIS_CHANNEL_PREFIX}_${key}`, subkey, typeof value === 'object' ? JSON.stringify(value) : value)
133
+ }
134
+ export async function hget(key, subkey) {
135
+ let value = await defaultSetGetConsumer.hget(`${process.env.REDIS_CHANNEL_PREFIX}_${key}`, subkey)
136
+ try { value = JSON.parse(value) } catch(err) { }
137
+ return value
138
+ }
139
+ export async function hdel(key, subkey) {
140
+ await defaultSetGetConsumer.hdel(`${process.env.REDIS_CHANNEL_PREFIX}_${key}`, subkey)
141
+ }
142
+
131
143
  // Hydrate
132
144
 
133
145
  export async function hydrate(callback) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.155",
4
+ "version": "1.0.157",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {