http://static.artfulcode.net/newlisp/memcached.lsp.html
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.
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.
Code: Select all
> (load "memcached.lsp")
MAIN
> (memcached:init)
true
> (memcached:add-server "localhost" 11211)
true
> (memcached:get-key "doesnt_exist")
true
Code: Select all
(define (get-key key , res (value-length 0) (flags 0))
(when MEMCACHED
(setq res (memcached_get MEMCACHED
key (length key)
(address value-length)
(address flags)
(address MEMCACHED_RETURN)))
;(unless (zero? res) (get-string res))))
(if (zero? res)
nil
(get-string res))))
Code: Select all
> (load "memcached.lsp")
MAIN
> (memcached:init)
true
> (memcached:add-server "localhost" 11211)
true
> (memcached:get-key "TEST")
nil
> (memcached:set-key "TEST" "testing" 60)
"testing"
> (memcached:get-key "TEST")
"testing"
> (sleep 60000)
60000
> (memcached:get-key "TEST")
nil