Nikhil Marathe committed 452912f

Added macro to create inline command functions and send them

Comments (0)

Files changed (1)

 (context 'redis)
-(define (split str)
-  (parse str redis:CRLF))
+(constant 'CRLF "\r\n")
+(constant 'BUFSIZE 4096)
+(constant 'inline-commands 
+  '("ping" "bgsave" "get" "quit" "auth" "exists" "type" "select" "dbsize"))
+(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))))))
 (context MAIN)
       (list redis sock ""))))
-(define redis:CRLF "\r\n")
-(define redis:BUFSIZE 4096)
 (define (redis:query r command-str)
   (net-send (r 1) (append command-str redis:CRLF))
   (net-receive (r 1) buf redis:BUFSIZE)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.