ledisdb/doc/DiffRedis.md

63 lines
1.8 KiB
Markdown
Raw Normal View History

2014-09-09 06:01:46 +04:00
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.
## 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`
2014-11-28 10:48:16 +03:00
+ Hash: `hclear`, `hmclear`
+ List: `lclear`, `lmclear`
+ Set: `sclear`, `smclear`
2015-03-03 04:21:00 +03:00
+ ZSet: `zclear`, `zmclear`
2014-09-09 06:01:46 +04:00
## 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`
## 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
2015-03-03 04:21:00 +03:00
LedisDB supplies `xscan`, `xhscan`, `xsscan`, `xzscan` to fetch data iteratively and reverse iteratively.
2014-10-20 18:36:16 +04:00
2015-03-03 04:21:00 +03:00
```
XSCAN type cursor [MATCH match] [COUNT count]
XHSCAN key cursor [MATCH match] [COUNT count]
XSSCAN key cursor [MATCH match] [COUNT count]
XZSCAN key cursor [MATCH match] [COUNT count]
```
2014-09-09 06:01:46 +04:00
2014-11-27 09:03:44 +03:00
## DUMP
+ KV: `dump`
+ Hash: `hdump`
+ List: `ldump`
+ Set: `sdump`
+ ZSet: `zdump`
LedisDB supports `dump` to serialize the value with key, the data format is the same as Redis, so you can use it in Redis and vice versa.
2014-09-09 06:01:46 +04:00
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).