MCPcopy
hub / github.com/redis/go-redis / checkKeys

Method checkKeys

example/del-keys-without-ttl/main.go:109–131  ·  view source on GitHub ↗
(ctx context.Context, keys []string)

Source from the content-addressed store, hash-verified

107}
108
109func (c *KeyChecker) checkKeys(ctx context.Context, keys []string) error {
110 cmds, err := c.rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {
111 for _, key := range keys {
112 pipe.TTL(ctx, key)
113 }
114 return nil
115 })
116 if err != nil {
117 return err
118 }
119
120 for i, cmd := range cmds {
121 d, err := cmd.(*redis.DurationCmd).Result()
122 if err != nil {
123 return err
124 }
125 if d == -1 {
126 c.delCh <- keys[i]
127 }
128 }
129
130 return nil
131}
132
133func (c *KeyChecker) del(ctx context.Context) error {
134 pipe := c.rdb.Pipeline()

Callers 1

StartMethod · 0.95

Calls 3

PipelinedMethod · 0.65
TTLMethod · 0.65
ResultMethod · 0.65

Tested by

no test coverage detected