diff options
| author | Adam Soltys <[email protected]> | 2023-12-29 10:25:52 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-29 10:27:15 +0000 |
| commit | 54fcccb8c54c7598dce6470f576a515e7658d341 (patch) | |
| tree | aa624834907f47fb9d76800fa0d58ee92a9306c8 /lib/db.js | |
| parent | c474dbb763480ec923cd49f5cac0e07a310552a7 (diff) | |
| download | coinos-server-54fcccb8c54c7598dce6470f576a515e7658d341.tar.gz coinos-server-54fcccb8c54c7598dce6470f576a515e7658d341.zip | |
helper function
Diffstat (limited to 'lib/db.js')
| -rw-r--r-- | lib/db.js | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 { |
