Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ql:quickload 'cl-redis)
- (eval-when (:compile-toplevel :load-toplevel :execute)
- (defparameter *connection-info* '(:host #(127 0 0 1))))
- (defmacro with-connection-info (() &body body)
- `(redis:with-persistent-connection ,*connection-info*
- ,@body))
- ;; This trace allows us to see which set of connection info is in use
- (trace usocket:socket-connect)
- ;; This expands as using fakedomain:14 (correct)...
- (let ((*connection-info* '(:host "fakedomain" :port 14)))
- (macroexpand-1 '(with-connection-info () (redis:red-get "foo"))))
- ;; ... but this runs using the top-level definition (incorrect)!
- (let ((*connection-info* '(:host "fakedomain" :port 14)))
- (with-connection-info () (redis:red-get "foo")))
- ;; What am I missing?!
Add Comment
Please, Sign In to add comment