redis high-level api suggestion pasted by DerGuteMoritz on Fri May 27 19:29:58 2011

(define conn (redis-connect host: "call-cc.org"))

(let-redis conn
  (foo bar (baz 'baz))
  (foo)          ; sends "GET foo", caches the response and returns it
  (bar)          ; sends "GET bar"
  (baz)          ; sends "GET another-key"
  (foo)          ; returns the cached value
  (foo 'set 1)
  (foo #t)               ; sends a GET command, overriding the cache
  (foo 'increment)       ; sends "INCR foo" and returns the new count
  (foo 'increment-by 10) ; sends "INCRBY foo 10"  and returns the new count
  (yes))

;; expansion
(let ((foo (redis conn 'foo))
      (bar (redis conn 'bar))
      (baz (redis conn 'another-key)))
  ...)

whoops, typo added by DerGuteMoritz on Fri May 27 19:30:51 2011

(define conn (redis-connect host: "call-cc.org"))

(let-redis conn
  (foo bar (baz 'another-key))
  (foo)          ; sends "GET foo", caches the response and returns it
  (bar)          ; sends "GET bar"
  (baz)          ; sends "GET another-key"
  (foo)          ; returns the cached value
  (foo 'set 1)
  (foo #t)               ; sends a GET command, overriding the cache
  (foo 'increment)       ; sends "INCR foo" and returns the new count
  (foo 'increment-by 10) ; sends "INCRBY foo 10"  and returns the new count
  (yes))

;; expansion
(let ((foo (redis conn 'foo))
      (bar (redis conn 'bar))
      (baz (redis conn 'another-key)))
  ...)