Documentation
¶
Overview ¶
This code is mostly copied from Beego BeeMap
Index ¶
- Constants
- func Decode(c *cli.Context, decoder *decoder.Decoder, filepath string)
- func Dump(path string) (map[string]interface{}, error)
- func Export_All_Keys(cli *cli.Context)
- func GetData(filename string, cnt *Counter, topN int, sizeFilter int64) map[string]interface{}
- func InitHTMLTmpl()
- func Key(key string) string
- func ParseUnitToBytes(sizeStr string) (int64, error)
- func ServeHTML(w http.ResponseWriter, layout string, content string, ...)
- func Show(c *cli.Context)
- func Slot(key string) int
- func ToCliWriter(cli *cli.Context)
- func ToCliWriterToFile(cli *cli.Context)
- type Counter
- type CounterConfig
- type PrefixEntry
- type SafeMap
- type SlotEntry
Constants ¶
const ( DefaultTopBigKeyNum = 500 DefaultSeparators = ":;,_- " DefaultStoreAllPrefixes = false DefaultTopPrefixNum = 500 DefaultPrefixPreShrinkNum = 5000 DefaultPrefixContainerMaxCapacity = 50000 )
v1.1.4 add
Variables ¶
This section is empty.
Functions ¶
func Export_All_Keys ¶ added in v1.1.3
keys is function for command `keys` output all keys in rdb file(s) get from args
func InitHTMLTmpl ¶
func InitHTMLTmpl()
func ParseUnitToBytes ¶ added in v1.1.3
将带单位的字符串转换为字节数
func ServeHTML ¶
func ServeHTML(w http.ResponseWriter, layout string, content string, data map[string]interface{})
ServeHTML generate and write html to client
func ToCliWriter ¶
ToCliWriter dump rdb file statistical information to STDOUT.
func ToCliWriterToFile ¶ added in v1.0.6
ToCliWriter dump rdb file statistical information to file.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter for redis memory usage
func NewCounter ¶
func NewCounter(config *CounterConfig) *Counter
NewCounter return a pointer of Counter
func (*Counter) Count ¶
Count by various dimensions,show.go NewCounter 后,调用此方法,遍历decoder的entry, <-chan表示一个只能接收数据的单向通道
func (*Counter) GetLargestEntries ¶
GetLargestEntries from heap, num max is 500. 过滤掉小于阈值的key
func (*Counter) GetLargestKeyPrefixes ¶
func (c *Counter) GetLargestKeyPrefixes() []*PrefixEntry
GetLargestKeyPrefixes from heap
func (*Counter) GetLenLevelCount ¶
func (c *Counter) GetLenLevelCount() []*PrefixEntry
GetLenLevelCount from map
type CounterConfig ¶ added in v1.1.4
type CounterConfig struct {
// Bigkey数量阈值,默认 500
TopBigKeyNum int
// key前缀分隔符,默认 ":;,_- "
Separators string
// 是否存储所有前缀,仅当你的主机内存足够时开启,默认关闭
// false时,对前缀的存储量进行动态收缩, 前缀个数越多,创建的对象也就越多,从而耗内存就越多,就会因内存不足执行不完, 详见 https://github.com/919927181/rdr/issues/1
StoreAllPrefixes bool
// 前缀数量阈值,默认 500
TopPrefixNum int
// 前缀容器的最大容量,默认值为前缀数量阈值的10倍,可以理解为最大水位线,到达最大水位线,就要去排出一部分水
PrefixContainerMaxCapacity int
// 前缀容器的预缩容数量,可以理解为正常水位线
PrefixPreShrinkNum int
}
v1.1.4 add
type PrefixEntry ¶
type PrefixEntry struct {
Bytes uint64
Num uint64
Db string //之前为int
// contains filtered or unexported fields
}
PrefixEntry record value by prefix
type SafeMap ¶
type SafeMap struct {
// contains filtered or unexported fields
}
SafeMap is a map which concurrency safe
func (*SafeMap) Get ¶
func (m *SafeMap) Get(k interface{}) interface{}
Get from maps return the k's value
func (*SafeMap) Items ¶
func (m *SafeMap) Items() map[interface{}]interface{}
Items returns all items in safemap.