aboutsummaryrefslogtreecommitdiff
path: root/shards.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-08 20:41:39 +0200
committeralex <[email protected]>2026-07-08 20:41:39 +0200
commit2d2b8102ecc5b6a786a97c6c0fc49737c9088e63 (patch)
tree1d8e6d18ebf3bb5528ef5f1725e63dd77f7eedc3 /shards.go
parent1cfae9f67a9ff7240d77ece8a2e0c54326e35c66 (diff)
downloadredis-clone-2d2b8102ecc5b6a786a97c6c0fc49737c9088e63.tar.xz
redis-clone-2d2b8102ecc5b6a786a97c6c0fc49737c9088e63.zip
made NumShards a global const
Diffstat (limited to 'shards.go')
-rw-r--r--shards.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/shards.go b/shards.go
index cba4dd4..c69f920 100644
--- a/shards.go
+++ b/shards.go
@@ -15,7 +15,7 @@ func (db *RedisDB) getShard(key string)*Shard{
hash.Write([]byte(key))
val := hash.Sum64()
- return db.shards[val%16]
+ return db.shards[val%NumShards]
}
func (db *RedisDB) Execute(key string, fn func(*Shard) interface{}) interface{} {