author | Alberto Bertogli
<albertito@gmail.com> 2007-04-29 07:33:58 UTC |
committer | Alberto Bertogli
<albertito@gmail.com> 2007-04-29 07:33:58 UTC |
parent | 301194414ad407c4be8889fda996cc45fe30722e |
bindings/newlisp/nmdb.lsp | +16 | -0 |
bindings/newlisp/test.lsp | +6 | -3 |
diff --git a/bindings/newlisp/nmdb.lsp b/bindings/newlisp/nmdb.lsp index 89f8085..ba61413 100644 --- a/bindings/newlisp/nmdb.lsp +++ b/bindings/newlisp/nmdb.lsp @@ -54,6 +54,9 @@ (import libnmdb "nmdb_del_sync") (import libnmdb "nmdb_cache_del") +(import libnmdb "nmdb_cas") +(import libnmdb "nmdb_cache_cas") + ; main functions @@ -108,6 +111,19 @@ (define (cache-del key) (priv-del nmdb_cache_del key)) +; *-cas functions +(define (priv-cas func key oldval newval) + (letn ( (keylen (length key)) + (ovlen (length oldval)) + (nvlen (length newval)) + ) + (func NMDB key keylen oldval ovlen newval nvlen) ) ) + +(define (db-cas key oval nval) (priv-cas nmdb_cas key oval nval)) +(define (cache-cas key oval nval) (priv-cas nmdb_cache_cas key oval nval)) + + + (context MAIN) diff --git a/bindings/newlisp/test.lsp b/bindings/newlisp/test.lsp index a1371dd..0fb90a2 100644 --- a/bindings/newlisp/test.lsp +++ b/bindings/newlisp/test.lsp @@ -4,9 +4,9 @@ (load "nmdb.lsp") (println "init\t\t" (nmdb:init 10)) -(println "add-server\t" (nmdb:add-server 11)) -(println "add-server\t" (nmdb:add-server 12)) -(println "add-server\t" (nmdb:add-server 13)) +;(println "add-server\t" (nmdb:add-server 11)) +;(println "add-server\t" (nmdb:add-server 12)) +;(println "add-server\t" (nmdb:add-server 13)) (println) (println "db-set D1 V1\t" (nmdb:db-set "D1" "D1")) (println "sync-set S2 V2\t" (nmdb:sync-set "S2" "V2")) @@ -16,6 +16,9 @@ (println "db-get S2\t" (nmdb:db-get "S2")) (println "cache-get C3\t" (nmdb:cache-get "C3")) (println) +(println "db-cas D1\t" (nmdb:db-cas "D1" "D1" "DX")) +(println "cache-cas C3\t" (nmdb:cache-cas "C3" "C3" "CX")) +(println) (println "db-del D1\t" (nmdb:db-del "D1")) (println "sync-del S2\t" (nmdb:sync-del "S2")) (println "cache-del C3\t" (nmdb:cache-del "C3"))