MCPcopy
hub / github.com/CodisLabs/codis / InfoKeySpace

Method InfoKeySpace

pkg/utils/redis/client.go:138–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136}
137
138func (c *Client) InfoKeySpace() (map[int]string, error) {
139 text, err := redigo.String(c.Do("INFO", "keyspace"))
140 if err != nil {
141 return nil, errors.Trace(err)
142 }
143 info := make(map[int]string)
144 for _, line := range strings.Split(text, "\n") {
145 kv := strings.SplitN(line, ":", 2)
146 if len(kv) != 2 {
147 continue
148 }
149 if key := strings.TrimSpace(kv[0]); key != "" && strings.HasPrefix(key, "db") {
150 n, err := strconv.Atoi(key[2:])
151 if err != nil {
152 return nil, errors.Trace(err)
153 }
154 info[n] = strings.TrimSpace(kv[1])
155 }
156 }
157 return info, nil
158}
159
160func (c *Client) InfoFull() (map[string]string, error) {
161 if info, err := c.Info(); err != nil {

Callers 1

newSlotActionExecutorMethod · 0.80

Calls 2

DoMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected