Hi, dear developer
I've made some changes to your code to support LispWorks 5.0.2, take it if you want.
Thanks.
Chun Tian (binghe)
diff -ru cl-memcached-0.4.1.orig/cl-memcached.asd cl-memcached-0.4.1/cl-memcached.asd --- cl-memcached-0.4.1.orig/cl-memcached.asd 2007-08-02 22:30:55.000000000 +0800 +++ cl-memcached-0.4.1/cl-memcached.asd 2007-08-23 16:49:11.000000000 +0800 @@ -19,7 +19,8 @@ :author "quasi quasi@cleartrip.com" :serial t :depends-on (:usocket - :split-sequence) + :split-sequence + :cl-who) :components ((:file "packages") (:file "util") (:file "compat") diff -ru cl-memcached-0.4.1.orig/cl-memcached.lisp cl-memcached-0.4.1/cl-memcached.lisp --- cl-memcached-0.4.1.orig/cl-memcached.lisp 2007-08-02 22:30:55.000000000 +0800 +++ cl-memcached-0.4.1/cl-memcached.lisp 2007-08-25 00:42:09.000000000 +0800 @@ -35,9 +35,6 @@ ;; (declaim (optimize (speed 3) (debug 0))))
-(defvar *memcache* - "Represents a particular Memcached server") - (defvar *use-pool* nil "Default value for the USE-POOL keyword parameter in memcached functions")
@@ -130,6 +127,7 @@
(defmethod initialize-instance :after ((memcache memcache) &rest initargs) + (declare (ignore initargs)) (setf (slot-value memcache 'pool) (make-instance 'memcache-connection-pool :name (concatenate 'simple-string (name memcache) " - Connection Pool") :max-capacity (pool-size memcache))) (handler-case (mc-pool-init :memcache memcache) (error () nil)) @@ -184,13 +182,15 @@ memcache => The instance of class memcache which represnts the memcached we want to use. command => The storage command we want to use. There are 3 available : set, add & replace. timeout => The time in seconds when this data expires. 0 is never expire." - (declare (type fixnum timeout length) (type simple-string key)) + (declare (type fixnum timeout) (type simple-string key) + (type (member :set :add :replace) command)) (let ((len (length data))) (mc-with-pool-y/n (write-string (case command (:set "set") (:add "add") - (:replace "replace")) s) + (:replace "replace") + (t "error")) s) (write-char #\Space s) (write-string key s) (write-char #\Space s) @@ -231,12 +231,11 @@ until (search "END" x :test #'string-equal) collect (let* ((status-line (split-sequence:split-sequence #\Space x)) (len (parse-integer (fourth status-line))) - (seq (if is-string - (make-array len :element-type 'character) - (make-sequence '(vector (unsigned-byte 8)) len)))) + (seq (make-sequence '(vector (unsigned-byte 8)) len))) (read-sequence seq s) (read-line s nil nil) - (list (second status-line) seq))))) + (list (second status-line) + (if is-string (map 'string #'code-char seq) seq))))))
(defun mc-get+ (key-or-list-of-keys &key (memcache *memcache*) (use-pool *use-pool*)) @@ -293,7 +292,6 @@
(defun mc-stats-raw (&key (memcache *memcache*) (use-pool *use-pool*)) "Returns Raw stats data from memcached server to be used by the mc-stats function" - (declare (type fixnum port)) (mc-with-pool-y/n (with-output-to-string (str) (format s "stats~A" +crlf+) cl-memcached-0.4.1だけに発見: debian diff -ru cl-memcached-0.4.1.orig/packages.lisp cl-memcached-0.4.1/packages.lisp --- cl-memcached-0.4.1.orig/packages.lisp 2007-08-02 22:30:55.000000000 +0800 +++ cl-memcached-0.4.1/packages.lisp 2007-08-23 16:49:11.000000000 +0800 @@ -26,22 +26,22 @@ ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-(in-package #:cl-user) +(in-package :cl-user)
-(defpackage #:cl-memcached - (:use #:cl) - (:export #:*memcache* - #:memcache - #:mc-store - #:mc-get - #:mc-get+ - #:mc-del - #:mc-incr - #:mc-decr - #:mc-stats - #:mc-make-memcache-instance - #:mc-server-check - #:mc-pool-init - #:*use-pool*)) +(defpackage cl-memcached + (:use :cl :usocket) + (:export *memcache* + memcache + mc-store + mc-get + mc-get+ + mc-del + mc-incr + mc-decr + mc-stats + mc-make-memcache-instance + mc-server-check + mc-pool-init + *use-pool*))
diff -ru cl-memcached-0.4.1.orig/util.lisp cl-memcached-0.4.1/util.lisp --- cl-memcached-0.4.1.orig/util.lisp 2007-08-02 22:30:55.000000000 +0800 +++ cl-memcached-0.4.1/util.lisp 2007-08-23 16:49:11.000000000 +0800 @@ -15,6 +15,8 @@ (string (code-char 13)) (string (code-char 10)))))
+(defvar *memcache* + "Represents a particular Memcached server")
(defun mc-server-check (&key (memcache *memcache*)) "Performs some basic tests on the Memcache instance and outputs a status string" @@ -72,7 +74,7 @@ (:tr (:td (format stream "Process ID")) (:td (format stream "~a" (cl-memcached::mc-stats-pid stats)))) (:tr - (:td (format stream "Server Uptime")) (:td (format stream "~a" (ct-utils::sec-to-human-time-str (cl-memcached::mc-stats-uptime stats))))) + (:td (format stream "Server Uptime")) (:td (format stream "~a" (cl-memcached::mc-stats-uptime stats)))) (:tr (:td (format stream "System Time")) (:td (format stream "~a" (cl-memcached::mc-stats-time stats)))) (:tr
Chun Tian (binghe) wrote:
Hi, dear developer
I've made some changes to your code to support LispWorks 5.0.2, take it if you want.
Thank you for the patch. I have made the changes and checked on LispWorks 5.0.1. I will release a new version as soon as I get time to test on SBCL.
thanks for the inputs. I hope you find the library useful.
quasi
Thanks.
Chun Tian (binghe)
With my pleasure, and thanks for your work.
BTW, I have a LispWorks 64-bit Enterprise Edition on Linux, glad to test you code in the future.
quasi wrote:
Chun Tian (binghe) wrote:
Hi, dear developer
I've made some changes to your code to support LispWorks 5.0.2, take it if you want.
Thank you for the patch. I have made the changes and checked on LispWorks 5.0.1. I will release a new version as soon as I get time to test on SBCL.
thanks for the inputs. I hope you find the library useful.
quasi
Thanks.
Chun Tian (binghe)
cl-memcached-devel@common-lisp.net