ledisdb/ledis/doc.go

62 lines
1.8 KiB
Go
Raw Normal View History

2014-07-25 13:58:00 +04:00
// Package ledis is a high performance embedded NoSQL.
//
2014-08-16 05:43:37 +04:00
// Ledis supports various data structure like kv, list, hash and zset like redis.
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// Other features include binlog replication, data with a limited time-to-live.
2014-06-22 17:13:57 +04:00
//
2014-06-25 08:57:19 +04:00
// Usage
//
2014-06-22 17:05:52 +04:00
// First create a ledis instance before use:
2014-06-22 17:13:57 +04:00
//
// l := ledis.Open(cfg)
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// cfg is a Config instance which contains configuration for ledis use,
// like DataDir (root directory for ledis working to store data).
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// After you create a ledis instance, you can select a DB to store you data:
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// db, _ := l.Select(0)
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// DB must be selected by a index, ledis supports only 16 databases, so the index range is [0-15].
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// KV
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// KV is the most basic ledis type like any other key-value database.
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// err := db.Set(key, value)
// value, err := db.Get(key)
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// List
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// List is simply lists of values, sorted by insertion order.
// You can push or pop value on the list head (left) or tail (right).
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// err := db.LPush(key, value1)
// err := db.RPush(key, value2)
// value1, err := db.LPop(key)
// value2, err := db.RPop(key)
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// Hash
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// Hash is a map between fields and values.
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// n, err := db.HSet(key, field1, value1)
// n, err := db.HSet(key, field2, value2)
// value1, err := db.HGet(key, field1)
// value2, err := db.HGet(key, field2)
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// ZSet
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// ZSet is a sorted collections of values.
// Every member of zset is associated with score, a int64 value which used to sort, from smallest to greatest score.
// Members are unique, but score may be same.
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// n, err := db.ZAdd(key, ScorePair{score1, member1}, ScorePair{score2, member2})
// ay, err := db.ZRangeByScore(key, minScore, maxScore, 0, -1)
2014-06-22 17:13:57 +04:00
//
2014-06-22 17:05:52 +04:00
// Binlog
2014-06-25 08:57:19 +04:00
//
2014-06-22 17:05:52 +04:00
// ledis supports binlog, so you can sync binlog to another server for replication. If you want to open binlog support, set UseBinLog to true in config.
2014-06-25 08:57:19 +04:00
//
2014-06-22 17:05:52 +04:00
package ledis