aboutsummaryrefslogtreecommitdiffstats
path: root/lib/db.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-29 10:25:52 +0000
committerAdam Soltys <[email protected]>2023-12-29 10:27:15 +0000
commit54fcccb8c54c7598dce6470f576a515e7658d341 (patch)
treeaa624834907f47fb9d76800fa0d58ee92a9306c8 /lib/db.js
parentc474dbb763480ec923cd49f5cac0e07a310552a7 (diff)
downloadcoinos-server-54fcccb8c54c7598dce6470f576a515e7658d341.tar.gz
coinos-server-54fcccb8c54c7598dce6470f576a515e7658d341.zip
helper function
Diffstat (limited to 'lib/db.js')
-rw-r--r--lib/db.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/db.js b/lib/db.js
index c44c7177..a664ca32 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -88,6 +88,7 @@ export let g = async (k) => {
return v;
}
};
+
export let s = (k, v) => {
if (k === "user:null" || k === "user:undefined") {
warn("###### NULL USER #######");
@@ -96,6 +97,23 @@ export let s = (k, v) => {
db.set(k, JSON.stringify(v));
};
+export let ga = async (k) => {
+ let v = await archive.get(k);
+ try {
+ return JSON.parse(v);
+ } catch (e) {
+ return v;
+ }
+};
+
+export let sa = (k, v) => {
+ if (k === "user:null" || k === "user:undefined") {
+ warn("###### NULL USER #######");
+ console.trace();
+ }
+ archive.set(k, JSON.stringify(v));
+};
+
let retries = {};
export let t = async (k, f) => {
try {