author | Alberto Bertogli
<albertito@gmail.com> 2007-09-02 00:17:56 UTC |
committer | Alberto Bertogli
<albertito@gmail.com> 2007-09-02 00:17:56 UTC |
parent | 2f2236c5b055564455ffc41326b5e7cb46ddc4e8 |
bindings/newlisp/nmdb.lsp | +11 | -0 |
bindings/newlisp/test.lsp | +5 | -1 |
diff --git a/bindings/newlisp/nmdb.lsp b/bindings/newlisp/nmdb.lsp index a095f93..640bfe7 100644 --- a/bindings/newlisp/nmdb.lsp +++ b/bindings/newlisp/nmdb.lsp @@ -62,6 +62,9 @@ (import libnmdb "nmdb_cas") (import libnmdb "nmdb_cache_cas") +(import libnmdb "nmdb_incr") +(import libnmdb "nmdb_cache_incr") + ; main functions @@ -137,6 +140,14 @@ (define (cache-cas key oval nval) (priv-cas nmdb_cache_cas key oval nval)) +; *-incr functions +(define (priv-incr func key increment) + (letn ( (keylen (length key)) ) + (func NMDB key keylen increment) ) ) + +(define (db-incr key increment) (priv-incr nmdb_incr key increment)) +(define (cache-incr key increment) (priv-incr nmdb_cache_incr key increment)) + (context MAIN) diff --git a/bindings/newlisp/test.lsp b/bindings/newlisp/test.lsp index 1c5e9a9..124567f 100644 --- a/bindings/newlisp/test.lsp +++ b/bindings/newlisp/test.lsp @@ -25,6 +25,10 @@ (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")) - +(println) +(println "cache-set I 10\t" (nmdb:cache-set "I" "10\000")) +(println "cache-incr I 10\t" (nmdb:cache-incr "I" 10)) +(println "cache-get I\t" (nmdb:cache-get "I")) +(println) (exit)