diff options
| author | LLLL Colonq <llll@colonq> | 2024-09-13 13:52:38 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-09-13 13:52:38 -0400 |
| commit | d93ab7e848bf0f4bc1087504eecd7c959d19bf6c (patch) | |
| tree | f4f1806ceb56d2a68c9641313000f9a50fa77d78 /src/wasp-db.el | |
| parent | cc3ccebbd3af825f5e4866532906f1a7a2756518 (diff) | |
Update :3
Diffstat (limited to 'src/wasp-db.el')
| -rw-r--r-- | src/wasp-db.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/wasp-db.el b/src/wasp-db.el index b56fe40a..506002a1 100644 --- a/src/wasp-db.el +++ b/src/wasp-db.el @@ -39,7 +39,7 @@ (defun w/db-parse-value () "Parse a single RESP value from the current buffer." - (w/write-log (format "parsing: %S" (buffer-string))) + ;; (w/write-log (format "parsing: %S" (buffer-string))) (when-let ((c (char-after))) (delete-char 1) (cl-case c @@ -93,7 +93,7 @@ If not, return nil." (defun w/db-send-raw (msg) "Send MSG to Redis." - (w/write-log (format "sending to redis: %s" msg)) + ;; (w/write-log (format "sending to redis: %s" msg)) (process-send-string w/db-process msg)) (defun w/db-cmd (cmd k) @@ -122,6 +122,12 @@ If not, return nil." :service w/db-port :filter #'w/db-process-filter)) +(defun w/db-keys (pat k) + "Retrieve the list of keys matching PAT and pass them to K." + (if (stringp pat) + (w/db-cmd `("KEYS" ,pat) k) + (error "Redis pattern must be string"))) + (defun w/db-set (key val) "Set KEY to VAL in Redis." (if (and (stringp key) (stringp val)) @@ -134,6 +140,10 @@ If not, return nil." (w/db-cmd `("GET" ,key) k) (error "Redis key must be string"))) +(defun w/db-mget (keys k) + "Get KEYS from Redis and pass the corresponding values to K." + (w/db-cmd `("MGET" ,@keys) k)) + (defun w/db-hset (key hkey val &rest vals) "Set HKEY in hash KEY to VAL in Redis." (w/db-cmd `("HSET" ,key ,hkey ,val ,@vals) (lambda (_) nil))) |
