Renato Lucindo wrote:
Hello,
I have a few questions about cl-memcached:
- Which object type is possible to store on memcached using
cl-memcached? CLOS objects instances? Hash tables? Structures?
memcached stores just bytes. We can retrieve these bytes by using a key with which their storage is associated. We can store anything in memcached, but the serialization etc. has to be our responsibility. For example using cl-store and flexi-streams we can store anything that cl-store can serialize.
for example:
(defun cl-store-in-memcache (key obj &key (memcache *memcache*) ((:command command) :set) ((:timeout timeout) 0) ((:use-pool use-pool) *use-pool*)) "Serializes 'obj' with cl-store and stores in memcache" (let ((seq (flexi-streams:with-output-to-sequence (out) (cl-store:store obj out)))) (cl-memcached:mc-store key seq :memcache memcache :command command :timeout timeout :use-pool use-pool)))
(defun cl-restore-from-memcache (keys-list &key (memcache *memcache*) ((:use-pool use-pool) *use-pool*)) "Gets objects corresponding to keys from keys-list. cl-store will throw and RESTORE-ERROR if an object retrieved has not been encoded by cl-store. i.e. if it cannot find a method to de-serialize it Returned is an alist of key and objects" (mapcar #'(lambda (x) (list (first x) (flexi-streams:with-input-from-sequence (in (second x)) (cl-store:restore in)))) (cl-memcached:mc-get keys-list :memcache memcache :use-pool use-pool))))
- When cl-memcached will support multiple servers (with weights) like
others memcached clients?
Shortly. :) Am planning to work on this, but have had absolutely no time. Any help would be appreciated. I also need replicated pairs support.
- cl-memcached supports compression?
cl-memcached is supposed to be very simple library and as fast as possible. You can very easily add a wrapper to use any compression method you like to compress before you pass to cl-memcached. e.g. http://common-lisp.net/project/gzip-stream/
Compression requires lots of CPU. But your specific needs may warrant the use of compression in which case it is not too difficult to add.
- cl-memcached will support other lisp implementations? (SBCL, CMUCL, CLISP??)
It already supports LW and SBCL. I will upload an updated tarball by this week end.
- cl-memcached will deal with strings internally (this way won't be
necessary pass :is-string parameter)?
I added this performance reasons. Typically a memcached server just sits and handles millions of requests. Adding checks which may not be used for most of the requests end up having an impact on performance which IMHO we can avoid. In case your app needs a specific setting, you can write a wrapper for that.
I followed the same philosophy for cl-memcached as is followed for memcached. :) do a simple job reliably and as fast as possible. I have tried to get the best possible performance from this client. Our memcached servers have been up upwards of 60 days at a time and have handled millions of requests per day. cl-memcached has been quite stable throughout the 12 months or so of its use till date.
Thanks!
thanks for writing in !! :)
quasi
Lucindo _______________________________________________ cl-memcached-devel mailing list cl-memcached-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cl-memcached-devel