From 23452f06c75c0c98744b4224aad8adab5734dced Mon Sep 17 00:00:00 2001 From: siddontang Date: Tue, 9 Sep 2014 10:01:46 +0800 Subject: [PATCH] add diff redid doc --- README.md | 2 +- doc/DiffRedis.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 doc/DiffRedis.md diff --git a/README.md b/README.md index 1dacb7b..e520031 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ LedisDB now supports multiple databases as backend to store data, you can test a + Supports transaction using LMDB or BotlDB. + Supports lua scripting. + Supports expiration and ttl. -+ Redis clients, like redis-cli, are supported directly. ++ Supports using redis-cli directly. + Multiple client API supports, including Go, Python, Lua(Openresty), C/C++, Node.js. + Easy to embed in your own Go application. + Restful API support, json/bson/msgpack output. diff --git a/doc/DiffRedis.md b/doc/DiffRedis.md new file mode 100644 index 0000000..ee1618c --- /dev/null +++ b/doc/DiffRedis.md @@ -0,0 +1,60 @@ + +LedisDB is not Redis, so you can not use some Redis clients for LedisDB directly. +But LedisDB uses Redis protocol for communication and many APIs are same as Redis, +so you can easily write your own LedisDB client based on a Redis one. + +Before you write a client, you must know some differences between LedisDB and Redis. + +## Data Structure + +LedisDB has no Strings data type but KV and Bitmap, any some Keys and Strings commands in Redis will only affect KV data, and "bit" commands affect Bitmap. + +## Del + +In Redis, `del` can delete all type data, like String, Hash, List, etc, but in LedisDB, `del` can only delete KV data. To delete other type data, you will use "clear" commands. + ++ KV: `del`, `mdel` ++ Hash: `hclear`, `mhclear` ++ List: `lclear`, `mlclear` ++ Set: `sclear`, `msclear` ++ Zset: `zclear`, `mzclear` ++ Bitmap: `bclear`, `mbclear` + +## Expire, Persist, and TTL + +The same for Del. + ++ KV: `expire`, `persist`, `ttl` ++ Hash: `hexpire`, `hpersist`, `httl` ++ List: `lexpire`, `lpersist`, `lttl` ++ Set: `sexpire`, `spersist`, `sttl` ++ Zset: `zexpire`, `zpersist`, `zttl` ++ Bitmap: `bexpire`, `bpersist`, `bttl` + +## ZSet + +ZSet only support int64 score, not double in Redis. + +## Transaction + +LedisDB supports ACID transaction using LMDB or BoltDB, maybe later it will support `multi`, `exec`, `discard`. + +Transaction API: + ++ `begin` ++ `commit` ++ `rollback` + +## Scan + +LedisDB supplies `xscan`, etc, to fetch data iteratively. + ++ KV: `xscan` ++ Hash: `hxscan` ++ List: `lxscan` ++ Set: `sxscan` ++ Zset: `zxscan` ++ Bitmap: `bxscan` + + +Of course, LedisDB has not implemented all APIs in Redis, you can see full commands in commands.json, commands.doc or [wiki](https://github.com/siddontang/ledisdb/wiki/Commands). \ No newline at end of file