Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: carld/redis-client.egg
base: b49986caa1
...
head fork: carld/redis-client.egg
compare: 096ecadf49
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
2  redis-client.release-info
View
@@ -1,3 +1,3 @@
(repo git "git://github.com/carld/{egg-name}.egg.git")
(uri targz "https://github.com/carld/{egg-name}.egg/tarball/{egg-release}")
-(release "0.2")
+(release "0.3")
25 redis-client.scm
View
@@ -1,6 +1,10 @@
; chicken-scheme redis-client
; Copyright (C) 2011 A. Carl Douglas
+(module redis-client *
+(import chicken scheme extras)
(use socket)
+(begin-for-syntax
+ (import chicken))
(define (redis-write-command port command args)
(fprintf port "*~A\r\n$~A\r\n~A\r\n~A~!"
@@ -30,10 +34,10 @@
(define-syntax make-redis-parameter-function
(lambda (x r c)
- (let ((command-proc (r (string->symbol(sprintf "redis-~A" (cadr x))))))
+ (let ((command-proc (string->symbol(sprintf "redis-~A" (cadr x)))))
`(define (,command-proc . args)
- (redis-write-command (redis-out-port) ',(cadr x) args)
- (redis-read-response (redis-in-port))))))
+ (redis-write-command (*redis-out-port*) ',(cadr x) args)
+ (redis-read-response (*redis-in-port*))))))
(define-syntax map-make-redis-parameter-function
(syntax-rules ()
@@ -147,8 +151,8 @@
slaveof
config))
-(define redis-in-port (make-parameter #f))
-(define redis-out-port (make-parameter #f))
+(define *redis-in-port* (make-parameter #f))
+(define *redis-out-port* (make-parameter #f))
(define *redis-socket* '())
@@ -156,11 +160,14 @@
(set! *redis-socket*
(socket-connect/ai
(address-information host port family: af/inet)))
- (define-values (in-port out-port)
+ (set! (so-keep-alive? *redis-socket*) #t)
+ (define-values (in-port out-port)
(socket-i/o-ports *redis-socket*))
- (redis-in-port in-port)
- (redis-out-port out-port)
- (and (port? (redis-in-port)) (port? (redis-out-port))))
+ (*redis-in-port* in-port)
+ (*redis-out-port* out-port)
+ (and (port? (*redis-in-port*)) (port? (*redis-out-port*))))
+
+)
; Example program:
;
7 redis-client.setup
View
@@ -1,5 +1,6 @@
-(compile -s redis-client.scm)
+(compile -s -d0 -O3 redis-client.scm -j redis-client)
+(compile -s -d0 -O3 redis-client.import.scm)
(install-extension
'redis-client
- '("redis-client.so")
- '((version "0.2")))
+ '("redis-client.so" "redis-client.import.so")
+ '((version "0.3")))
2  tests/run.scm
View
@@ -1,4 +1,4 @@
-(require-library redis-client)
+(use redis-client)
(define (test a b)
(pp a)

No commit comments for this range

Something went wrong with that request. Please try again.