CL-MEMCACHED is a Simple, Fast, Thread-Safe library to interface with the memcached object caching system. It implements the Memcached TEXT protocol.
Tested on SBCL, CCL, CMUCL.
memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Danga Interactive developed memcached to enhance the speed of LiveJournal.com, a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of webservers and a bunch of database servers. memcached dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization, and faster access to the databases on a memcache miss.
The code comes with a MIT-style license so you can basically do with it whatever you want.
Project page: cl-memcached.
Please post issues on the github page.
*mc-default-encoding*
*mc-use-pool*
*memcache*
make-memcache
mc-add
mc-append
mc-bytes
mc-cas
mc-cas-unique
mc-data
mc-data-raw
mc-decr
mc-del
mc-flags
mc-flush-all
mc-get
mc-get+
mc-get-value
mc-incr
mc-key
mc-prepend
mc-replace
mc-set
mc-stats
mc-stats-summary
mc-store
mc-touch
mc-verbosity
mc-version
Install using quicklisp : (ql:quickload 'cl-memcached)
CL-USER> (require 'cl-memcached)
NIL
CL-MEMCACHED> (in-package :cl-memcached)
#<PACKAGE "CL-MEMCACHED">
CL-MEMCACHED> (setf *memcache* (make-memcache))
#<MEMCACHED-SERVER Name:Memcache IP:127.0.0.1 Port:11211 >
CL-MEMCACHED> (mc-quick-test "foo" "bar")
Success SET
Success GET
NIL
CL-MEMCACHED> (mc-set "t1" "oooooooooooooooooooooo")
STORED
:INTERNAL
CL-MEMCACHED> (mc-get+ "t1")
#<MEMCACHED-RESPONSE Key:t1 Data-Length:22 >
CL-MEMCACHED> (describe *)
#<MEMCACHED-RESPONSE Key:t1 Data-Length:22 >
[structure-object]
Slots with :INSTANCE allocation:
KEY = "t1"
FLAGS = "0"
BYTES = 22
CAS-UNIQUE = NIL
DATA-RAW = #(111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111..
; No value
CL-MEMCACHED> (mc-data (mc-get+ "t1"))
"oooooooooooooooooooooo"
CL-MEMCACHED> (mc-get-value "t1")
"oooooooooooooooooooooo"
CL-MEMCACHED> (mc-set "t2" "0")
STORED
:INTERNAL
CL-MEMCACHED> (mc-incr "t3")
NOT_FOUND
CL-MEMCACHED> (mc-incr "t2")
1
1
CL-MEMCACHED> (mc-incr "t2")
2
1
CL-MEMCACHED> (mc-decr "t2")
1
1
[Special variable]
*mc-default-encoding*
Default encoding
[Special variable]
*mc-use-pool*
Default value for the MC-USE-POOL keyword parameter in memcached functions
[Special variable]
*memcache*
Represents a particular Memcached server
[Function]
make-memcache &key ip port name pool-size => result
Creates an instance of class MEMCACHE which represents a memcached server
[Function]
mc-add key data &key memcache timeout flags noreply external-format mc-use-pool => result
[Function]
mc-append key data &key memcache timeout flags noreply external-format mc-use-pool => result
[Function]
mc-bytes instance => result
Return whether debug-block represents elsewhere code.
[Function]
mc-cas key data cas-unique &key memcache timeout flags noreply external-format mc-use-pool => result
Check And Set Operation : Store this data buy only if no one else has updated since I last fetched it
[Function]
mc-cas-unique instance => result
Return whether debug-block represents elsewhere code.
[Function]
mc-data response &key external-format => result
[Function]
mc-data-raw instance => result
Return whether debug-block represents elsewhere code.
[Function]
mc-decr key &key value noreply memcache mc-use-pool => result
[Function]
mc-del key &key noreply memcache mc-use-pool => result
[Function]
mc-flags instance => result
Return whether debug-block represents elsewhere code.
[Function]
mc-flush-all &key delay noreply memcache mc-use-pool => result
[Function]
mc-get keys-list &key memcache mc-use-pool => result
[Function]
mc-get+ key-or-list-of-keys &key memcache mc-use-pool => result
Takes a key or a list of keys are returns a list of MEMCACHE-RESPONSE structures
[Function]
mc-get-value key &key memcache mc-use-pool external-format => result
A utility macro to query a key and return a external-format decoded string
[Function]
mc-incr key &key value noreply memcache mc-use-pool => result
[Function]
mc-key instance => result
Return whether debug-block represents elsewhere code.
[Function]
mc-prepend key data &key memcache timeout flags noreply external-format mc-use-pool => result
[Function]
mc-replace key data &key memcache timeout flags noreply external-format mc-use-pool => result
[Function]
mc-set key data &key memcache timeout flags noreply external-format mc-use-pool => result
[Function]
mc-stats &key memcache mc-use-pool => result
Returns an ALIST of stats data from memcached server
[Function]
mc-stats-summary &key memcache => result
[Function]
mc-store key data &key memcache command timeout flags noreply cas-unique mc-use-pool => result
Stores data in the memcached server using the :command command. KEY => KEY by which the DATA is stored. this is of type SIMPLE-STRING DATA => DATA to be stored into the cache. DATA has to be a sequence of TYPE (UNSIGNED-BYTE 8). MEMCACHE => A structure representing the MEMCACHE we want to use. command => The storage command we want to use. There are 5 available : set, add, replace, append & prepend. timeout => The time in seconds when this data expires. 0 is never expire. flags => noreply => server does not send a reply mc-use-pool => use connection from pool (much faster for load) response : - 'STOREDrn', to indicate success. - 'NOT_STOREDrn' to indicate the data was not stored, but not because of an error. This normally means that the condition for an 'add' or a 'replace' command wasn't met. - 'EXISTSrn' to indicate that the item you are trying to store with a 'cas' command has been modified since you last fetched it. - 'NOT_FOUNDrn' to indicate that the item you are trying to store with a 'cas' command did not exist.
[Function]
mc-touch key expiry-time &key noreply memcache mc-use-pool => result
[Function]
mc-verbosity &key level noreply memcache mc-use-pool => result
[Function]
mc-version &key memcache mc-use-pool => result
Abhijit 'quasi' Rao
This documentation was prepared with DOCUMENTATION-TEMPLATE.
$Header: /usr/local/cvsrep/documentation-template/output.lisp,v 1.18 2013-01-11 13:45:29 edi Exp $