KhighDB
KhighDB is a high-performance, embedded and disaster tolerant KV storage engine.
π Core Features
- Low latency, both for read and write.
- High throughput, especially when writing an incoming stream of random items.
- Powerful storage ability, handle datasets much larger than RAM w/o degradation.
- Crash friendliness, both in terms of fast recovery and not losing data.
- API supports most protocols of redis.
π Engine Architecture
KhighDB implementations Bitcask which is a log-structured hash table for fast key/value data.
Additionally, KhighDB uses adaptive-radix-tree to store the mete data of log entries.
β‘ Support Command
Common
- Ping
- Info
- Select
- Exit
- Auth
String
- Set
- Get
- MSet
- MGet
- Del
- GetRange
- GetDel
- SetEX
- SetNX
- MSetNX
- Append
- Incr
- IncrBy
- Decr
- DecrBy
- Expire
- TTL
- Persist
- StrLen
- StrLen
- Count
- Scan
- GetStrKeys
List
- LPush
- LPushX
- RPush
- RPushX
- LPop
- RPop
- LMove
- LLen
- LIndex
- LSet
- LRange
- LRem
Hash
- HSet
- HSetNX
- HGet
- HMGet
- HDel
- RExists
- HLen
- HKeys
- HVals
- HGetAll
- HStrLen
- HScan
- HIncrBy
- HRandField
Set
- SAdd
- SPop
- SRem
- SIsMember
- SMIsMember
- SMembers
- SCard
- SDiff
- SDiffStore
- SUnion
- SUnionStore
- SInter
- SInterStore
ZSet
- ZAdd
- ZRem
- ZScore
- ZCard
- ZRange
- ZRevRange
- ZRank
- ZRevRank
π« Embedded Usage
Make sure there is go 1.16
or newer in environment and then install KhighDB
.
go get -u github.com/Khighness/khighdb
Create or open a database:
opts := khighdb.DefaultOptions(path)
khighDB, err := khighdb.Open(opts)
...
defer khighDB.Close()
...
Write or read the key-value pair:
err := khighDB.Set([]byte("me"), []byte("Khighness"))
...
val, err := khighDB.Get([]byte("me"))
...
π Quick Start
Firstly, startup a Khigh server:
$ go run ./cmd/server/main.go -dbpath='/tmp' -host='127.0.0.1' -port=3333 -databases=16
Secondly, startup a Khigh client:
$ go run ./cmd/client/main.go -h=127.0.0.1 -p=3333
127.0.0.1:3333>set this KhighDB
$2
OK
127.0.0.1:3333>get this
$7
KhighDB
π MIT License
Khighness's khighdb is open-sourced system licensed under the MIT license.