Documentation ¶
Overview ¶
Package godis is a memory database with redis compatible interface
Index ¶
- func Auth(db *DB, c redis.Connection, args [][]byte) redis.Reply
- func BGRewriteAOF(db *DB, args [][]byte) redis.Reply
- func DiscardMulti(db *DB, conn redis.Connection) redis.Reply
- func EnqueueCmd(db *DB, conn redis.Connection, cmdLine [][]byte) redis.Reply
- func EntityToCmd(key string, entity *DataEntity) *reply.MultiBulkReply
- func ExecMulti(db *DB, conn redis.Connection, watching map[string]uint32, cmdLines []CmdLine) redis.Reply
- func Ping(db *DB, args [][]byte) redis.Reply
- func RegisterCommand(name string, executor ExecFunc, prepare PreFunc, rollback UndoFunc, arity int)
- func StartMulti(db *DB, conn redis.Connection) redis.Reply
- func Watch(db *DB, conn redis.Connection, args [][]byte) redis.Reply
- type CmdLine
- type DB
- func (db *DB) AddAof(args *reply.MultiBulkReply)
- func (db *DB) AfterClientClose(c redis.Connection)
- func (db *DB) Close()
- func (db *DB) Exec(c redis.Connection, cmdLine [][]byte) (result redis.Reply)
- func (db *DB) ExecWithLock(cmdLine [][]byte) redis.Reply
- func (db *DB) Expire(key string, expireTime time.Time)
- func (db *DB) Flush()
- func (db *DB) GetEntity(key string) (*DataEntity, bool)
- func (db *DB) GetRelatedKeys(cmdLine [][]byte) ([]string, []string)
- func (db *DB) GetUndoLogs(cmdLine [][]byte) []CmdLine
- func (db *DB) GetVersion(key string) uint32
- func (db *DB) IsExpired(key string) bool
- func (db *DB) Persist(key string)
- func (db *DB) PutEntity(key string, entity *DataEntity) int
- func (db *DB) PutIfAbsent(key string, entity *DataEntity) int
- func (db *DB) PutIfExists(key string, entity *DataEntity) int
- func (db *DB) RWLocks(writeKeys []string, readKeys []string)
- func (db *DB) RWUnLocks(writeKeys []string, readKeys []string)
- func (db *DB) Remove(key string)
- func (db *DB) Removes(keys ...string) (deleted int)
- type DataEntity
- type ExecFunc
- type PreFunc
- type UndoFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BGRewriteAOF ¶
BGRewriteAOF asynchronously rewrites Append-Only-File
func DiscardMulti ¶ added in v1.2.7
func DiscardMulti(db *DB, conn redis.Connection) redis.Reply
DiscardMulti drops MULTI pending commands
func EnqueueCmd ¶ added in v1.2.7
EnqueueCmd puts command line into `multi` pending queue
func EntityToCmd ¶
func EntityToCmd(key string, entity *DataEntity) *reply.MultiBulkReply
EntityToCmd serialize data entity to redis command
func ExecMulti ¶ added in v1.2.7
func ExecMulti(db *DB, conn redis.Connection, watching map[string]uint32, cmdLines []CmdLine) redis.Reply
ExecMulti executes multi commands transaction Atomically and Isolated
func RegisterCommand ¶ added in v1.2.7
RegisterCommand registers a new command arity means allowed number of cmdArgs, arity < 0 means len(args) >= -arity. for example: the arity of `get` is 2, `mget` is -2
func StartMulti ¶ added in v1.2.7
func StartMulti(db *DB, conn redis.Connection) redis.Reply
StartMulti starts multi-command-transaction
Types ¶
type CmdLine ¶ added in v1.2.7
type CmdLine = [][]byte
CmdLine is alias for [][]byte, represents a command line
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB stores data and execute user's commands
func (*DB) AddAof ¶
func (db *DB) AddAof(args *reply.MultiBulkReply)
AddAof send command to aof goroutine through channel
func (*DB) AfterClientClose ¶
func (db *DB) AfterClientClose(c redis.Connection)
AfterClientClose does some clean after client close connection
func (*DB) Exec ¶
Exec executes command parameter `cmdLine` contains command and its arguments, for example: "set key value"
func (*DB) ExecWithLock ¶ added in v1.2.7
ExecWithLock executes normal commands, invoker should provide locks
func (*DB) GetEntity ¶
func (db *DB) GetEntity(key string) (*DataEntity, bool)
GetEntity returns DataEntity bind to given key
func (*DB) GetRelatedKeys ¶ added in v1.2.7
GetRelatedKeys analysis related keys
func (*DB) GetUndoLogs ¶ added in v1.2.7
GetUndoLogs return rollback commands
func (*DB) GetVersion ¶ added in v1.2.7
func (*DB) PutEntity ¶
func (db *DB) PutEntity(key string, entity *DataEntity) int
PutEntity a DataEntity into DB
func (*DB) PutIfAbsent ¶
func (db *DB) PutIfAbsent(key string, entity *DataEntity) int
PutIfAbsent insert an DataEntity only if the key not exists
func (*DB) PutIfExists ¶
func (db *DB) PutIfExists(key string, entity *DataEntity) int
PutIfExists edit an existing DataEntity
type DataEntity ¶
type DataEntity struct {
Data interface{}
}
DataEntity stores data bound to a key, including a string, list, hash, set and so on
type ExecFunc ¶ added in v1.2.7
ExecFunc is interface for command executor args don't include cmd line
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cluster provides a server side cluster which is transparent to client.
|
Package cluster provides a server side cluster which is transparent to client. |
datastruct
|
|
interface
|
|
lib
|
|
redis
|
|