aboutsummaryrefslogtreecommitdiff
path: root/pkg/commands/del.go
blob: bc7d3f901ea972ce542c6e373cbbbd68d87ddf6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package commands

import "redisClone/pkg/core"

func Del(args []string, getShard func(k string) *core.Shard) interface{} {
            count := 0
            for _, key := range args[1:] {
                shard := getShard(key)
                if _, exists := shard.Data[key]; exists {
                    delete(shard.Data, key)
                    count++
                }
            }
            return count
        }