Sha256: 4b0cc8a3cb7e3ddd80f6c52869a1ab5b88751f7a530242e7acfcf11edd9090b0
Contents?: true
Size: 370 Bytes
Versions: 2
Compression:
Stored size: 370 Bytes
Contents
module RedisCluster class Slot KEY_PATTERN = /\{([^\}]*)\}/ # has tag key "{xxx}ooo" will calculate "xxx" for slot # if key is "{}dddd", calculate "{}dddd" for slot def self.slot_by(key) key = key.to_s KEY_PATTERN =~ key key = $1 if $1 && !$1.empty? CRC16.crc16(key) % Configuration::HASH_SLOTS end end # end Slot end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis_cluster-0.2.8 | lib/redis_cluster/slot.rb |
redis_cluster-0.2.7 | lib/redis_cluster/slot.rb |