1. Nikhil Marathe
  2. newlisp-redis


Nikhil Marathe  committed ce1059b

Separated query and read. Fixed indentation

  • Participants
  • Parent commits c8f793f
  • Branches default

Comments (0)

Files changed (1)

File redis.lsp

View file
  • Ignore whitespace
 (define (make-inline-command command)
   (letex ((fname (sym command)) (cmd command))
-        (define (fname r)
-          (letn ( (args-as-strings (map (fn (x) (string x)) (args)))
-                  (command-string (join (cons (upper-case cmd) args-as-strings) " ")) )
-              (:query r (append command-string redis:CRLF))))))
+    (define (fname r)
+      (letn ( (args-as-strings (map (fn (x) (string x)) (args)))
+              (command-string (join (cons (upper-case cmd) args-as-strings) " ")) )
+          (postprocess cmd (:query r (append command-string redis:CRLF)))))))
 (context MAIN)
   (:quit r)
   (net-close (r 1) true))
+; Simply sends a string to the server
+; And attempts to handle the reply
 (define (redis:query r command-str)
   (net-send (r 1) (append command-str redis:CRLF))
+  (redis:read r))
+; Separated from :query, so that bulk reply
+; handlers can call it multiple times in case
+; one read isn't enough.
+(define (redis:read r)
   (net-receive (r 1) buf redis:BUFSIZE)
   (write-buffer (r 2) buf)
   (:handle-reply r))