update document

This commit is contained in:
siddontang 2014-06-22 21:13:57 +08:00
parent d45a82897f
commit 794cb12ba4
3 changed files with 46 additions and 46 deletions

View File

@ -1,45 +1,45 @@
// Package ledis is a client for the ledisdb.
//
// Config
//
// Config struct contains configuration for ledisdb:
//
// Addr ledisdb server address, like 127.0.0.1:6380
// MaxIdleConns max idle connections for ledisdb
//
// Client
//
// The client is the primary interface for ledisdb. You must first create a client with proper config for working.
//
// cfg := new(Config)
// cfg.Addr = "127.0.0.1:6380"
// cfg.MaxIdleConns = 4
//
// c := NewClient(cfg)
//
// The most important function for client is Do function to send commands to remote server.
//
// reply, err := c.Do("ping")
//
// reply, err := c.Do("set", "key", "value")
//
// reply, err := c.Do("get", "key")
//
// Connection
//
// You can use an independent connection to send commands.
//
// //get a connection
// conn := c.Get()
//
// //connection send command
// conn.Do("ping")
//
// Reply Helper
//
// You can use reply helper to convert a reply to a specific type.
//
// exists, err := ledis.Bool(c.Do("exists", "key"))
//
// score, err := ledis.Int64(c.Do("zscore", "key", "member"))
package ledis

View File

@ -1,56 +1,56 @@
// Package ledis is a high performance embedded NoSQL based on leveldb.
// Ledis supports various advanced data structure like kv, list, hash and zset like redis.
//
// Other features include binlog replication, data with a limited time-to-live.
//
// First create a ledis instance before use:
//
// l := ledis.OpenWithConfig(cfg)
//
// cfg is a Config instance which contains configuration for ledis use,
// like DataDir (root directory for ledis working to store data).
//
// After you create a ledis instance, you can select a DB to store you data:
//
// db, _ := l.Select(0)
//
// DB must be selected by a index, ledis supports only 16 databases, so the index range is [0-15].
//
// KV
//
// KV is the most basic ledis type like any other key-value database.
//
// err := db.Set(key, value)
// value, err := db.Get(key)
//
// List
//
// List is simply lists of values, sorted by insertion order.
// You can push or pop value on the list head (left) or tail (right).
//
// err := db.LPush(key, value1)
// err := db.RPush(key, value2)
// value1, err := db.LPop(key)
// value2, err := db.RPop(key)
//
// Hash
//
// Hash is a map between fields and values.
//
// 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)
//
// ZSet
//
// 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.
//
// n, err := db.ZAdd(key, ScorePair{score1, member1}, ScorePair{score2, member2})
// ay, err := db.ZRangeByScore(key, minScore, maxScore, 0, -1)
//
// Binlog
// 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.
package ledis

View File

@ -1,25 +1,25 @@
// Package server supplies a way to use ledis as service.
// Server implements the redis protocol called RESP (REdis Serialization Protocol).
// For more information, please see http://redis.io/topics/protocol.
//
// You can use ledis with many available redis clients directly, for example, redis-cli.
// But I also supply some ledis client at client folder, and have been adding more for other languages.
//
// Start a ledis server is very simple:
//
// cfg := new(Config)
// cfg.Addr = "127.0.0.1:6380"
// cfg.DataDir = "/tmp/ledis"
// app := server.NewApp(cfg)
// app.Run()
//
// Replication
// You can start a slave ledis server for replication, open slave is simple too, you can set slaveof in config or run slaveof command in shell.
//
// For example, if you start a slave server, and the master server's address is 127.0.0.1:6380, you can start replication in shell:
//
// ledis-cli -p 6381
// ledis 127.0.0.1:6381 > slaveof 127.0.0.1 6380
//
// After you send slaveof command, the slave will start to sync master's binlog and replicate from binlog.
package server