Documentation ¶
Index ¶
Constants ¶
const ( // StringType is redis string StringType = "string" // ListType is redis list ListType = "list" // SetType is redis set SetType = "set" // HashType is redis hash HashType = "hash" // ZSetType is redis sorted set ZSetType = "zset" // AuxType is redis metadata key-value pair AuxType = "aux" // DBSizeType is for RDB_OPCODE_RESIZEDB DBSizeType = "dbsize" )
const ( // StringEncoding for string StringEncoding = "string" // ListEncoding is formed by a length encoding and some string ListEncoding = "list" // SetEncoding is formed by a length encoding and some string SetEncoding = "set" // ZSetEncoding is formed by a length encoding and some string ZSetEncoding = "zset" // HashEncoding is formed by a length encoding and some string HashEncoding = "hash" // ZSet2Encoding is zset version2 which stores doubles in binary format ZSet2Encoding = "zset2" // ZipMapEncoding has been deprecated ZipMapEncoding = "zipmap" // ZipListEncoding stores data in contiguous memory ZipListEncoding = "ziplist" // IntSetEncoding is a ordered list of integers IntSetEncoding = "intset" // QuickListEncoding is a list of ziplist QuickListEncoding = "quicklist" // ListPackEncoding is a new replacement for ziplist ListPackEncoding = "listpack" // QuickList2Encoding is a list of listpack QuickList2Encoding = "quicklist2" )
const QuicklistNodeContainerPacked = 2
QuicklistNodeContainerPacked means node of quicklist is list pack
const QuicklistNodeContainerPlain = 1
QuicklistNodeContainerPlain means node of quicklist is normal string
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuxObject ¶
type AuxObject struct { *BaseObject Value string }
AuxObject stores redis metadata
func (*AuxObject) MarshalJSON ¶
MarshalJSON marshal []byte as string
type BaseObject ¶
type BaseObject struct { DB int `json:"db"` // DB is db index of redis object Key string `json:"key"` // Key is key of redis object Expiration *time.Time `json:"expiration,omitempty"` // Expiration is expiration time, expiration of persistent object is nil Size int `json:"size"` // Size is rdb value size in Byte Type string `json:"type"` // Type is one of string/list/set/hash/zset Encoding string `json:"encoding"` // Encoding is the exact encoding method Extra interface{} `json:"-"` // Extra stores more detail of encoding for memory profiler and other usages }
BaseObject is basement of redis object
func (*BaseObject) GetDBIndex ¶
func (o *BaseObject) GetDBIndex() int
GetDBIndex returns db index of object
func (*BaseObject) GetElemCount ¶
func (o *BaseObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*BaseObject) GetEncoding ¶
func (o *BaseObject) GetEncoding() string
GetEncoding returns encoding of object
func (*BaseObject) GetExpiration ¶
func (o *BaseObject) GetExpiration() *time.Time
GetExpiration returns expiration time, expiration of persistent object is nil
func (*BaseObject) GetSize ¶
func (o *BaseObject) GetSize() int
GetSize returns rdb value size in Byte
type CallbackFunc ¶
type CallbackFunc func(object RedisObject) bool
CallbackFunc process redis object
type DBSizeObject ¶
type DBSizeObject struct { *BaseObject KeyCount uint64 TTLCount uint64 }
DBSizeObject stores db size metadata
func (*DBSizeObject) GetType ¶
func (o *DBSizeObject) GetType() string
GetType returns redis object type
type HashObject ¶
type HashObject struct { *BaseObject Hash map[string][]byte }
HashObject stores a hash object
func (*HashObject) GetElemCount ¶
func (o *HashObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*HashObject) GetType ¶
func (o *HashObject) GetType() string
GetType returns redis object type
func (*HashObject) MarshalJSON ¶
func (o *HashObject) MarshalJSON() ([]byte, error)
MarshalJSON marshal []byte as string
type IntsetDetail ¶
type IntsetDetail struct {
RawStringSize int
}
IntsetDetail stores detail for intset
type ListObject ¶
type ListObject struct { *BaseObject Values [][]byte }
ListObject stores a list object
func (*ListObject) GetElemCount ¶
func (o *ListObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*ListObject) GetType ¶
func (o *ListObject) GetType() string
GetType returns redis object type
func (*ListObject) MarshalJSON ¶
func (o *ListObject) MarshalJSON() ([]byte, error)
MarshalJSON marshal []byte as string
type Quicklist2Detail ¶
type Quicklist2Detail struct { // NodeEncodings means node of quicklist is QuicklistNodeContainerPlain or QuicklistNodeContainerPacked NodeEncodings []int // ListPackEntrySize stores sizes of each listPackEntry is node encoding is QuicklistNodeContainerPacked ListPackEntrySize [][]uint32 }
Quicklist2Detail stores detail for quicklist2
type QuicklistDetail ¶
type QuicklistDetail struct { // ZiplistStruct stores each ziplist within quicklist ZiplistStruct [][][]byte }
QuicklistDetail stores detail for quicklist
type RedisObject ¶
type RedisObject interface { // GetType returns redis type of object: string/list/set/hash/zset GetType() string // GetKey returns key of object GetKey() string // GetDBIndex returns db index of object GetDBIndex() int // GetExpiration returns expiration time, expiration of persistent object is nil GetExpiration() *time.Time // GetSize returns rdb value size in Byte GetSize() int // GetElemCount returns number of elements in list/set/hash/zset GetElemCount() int // GetEncoding returns encoding of object GetEncoding() string }
RedisObject is interface for a redis object
type SetObject ¶
type SetObject struct { *BaseObject Members [][]byte }
SetObject stores a set object
func (*SetObject) GetElemCount ¶
GetElemCount returns number of elements in list/set/hash/zset
func (*SetObject) MarshalJSON ¶
MarshalJSON marshal []byte as string
type StringObject ¶
type StringObject struct { *BaseObject Value []byte }
StringObject stores a string object
func (*StringObject) GetType ¶
func (o *StringObject) GetType() string
GetType returns redis object type
func (*StringObject) MarshalJSON ¶
func (o *StringObject) MarshalJSON() ([]byte, error)
MarshalJSON marshal []byte as string
type StructuredObject ¶
type StructuredObject struct { RedisInstaceName string `json:"RedisInstaceName"` // name of redis CreateDate *time.Time `json:"CreateDate"` Key string `json:"Key"` KeyText string `json:"KeyText"` Type string `json:"Type"` Size int `json:"Size"` Byte string `json:"byte"` ElemCount int `json:"ElemCount"` Expiration *time.Time `json:"Expiration"` DBIndex int `json:"DBIndex"` }
type ZSetObject ¶
type ZSetObject struct { *BaseObject Entries []*ZSetEntry `json:"entries"` }
ZSetObject stores a sorted set object
func (*ZSetObject) GetElemCount ¶
func (o *ZSetObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*ZSetObject) GetType ¶
func (o *ZSetObject) GetType() string
GetType returns redis object type
type ZiplistDetail ¶
type ZiplistDetail struct {
RawStringSize int
}
ZiplistDetail stores detail for ziplist