mirror of https://github.com/go-redis/redis.git
Unexport HashSlot.
This commit is contained in:
parent
2dc0bd1c0a
commit
36a06ec378
|
@ -79,7 +79,7 @@ func (c *ClusterClient) process(cmd Cmder) {
|
||||||
|
|
||||||
c.reloadIfDue()
|
c.reloadIfDue()
|
||||||
|
|
||||||
hashSlot := HashSlot(cmd.clusterKey())
|
hashSlot := hashSlot(cmd.clusterKey())
|
||||||
|
|
||||||
c.cachemx.RLock()
|
c.cachemx.RLock()
|
||||||
defer c.cachemx.RUnlock()
|
defer c.cachemx.RUnlock()
|
||||||
|
@ -288,9 +288,9 @@ func (opt *ClusterOptions) clientOptions() *Options {
|
||||||
|
|
||||||
const hashSlots = 16384
|
const hashSlots = 16384
|
||||||
|
|
||||||
// HashSlot returns a consistent slot number between 0 and 16383
|
// hashSlot returns a consistent slot number between 0 and 16383
|
||||||
// for any given string key
|
// for any given string key.
|
||||||
func HashSlot(key string) int {
|
func hashSlot(key string) int {
|
||||||
if s := strings.IndexByte(key, '{'); s > -1 {
|
if s := strings.IndexByte(key, '{'); s > -1 {
|
||||||
if e := strings.IndexByte(key[s+1:], '}'); e > 0 {
|
if e := strings.IndexByte(key[s+1:], '}'); e > 0 {
|
||||||
key = key[s+1 : s+e+1]
|
key = key[s+1 : s+e+1]
|
||||||
|
|
|
@ -3,3 +3,7 @@ package redis
|
||||||
func (c *baseClient) Pool() pool {
|
func (c *baseClient) Pool() pool {
|
||||||
return c.connPool
|
return c.connPool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HashSlot(key string) int {
|
||||||
|
return hashSlot(key)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue