@@ -0,0 +1,606 @@
+package org.finikes.sider.base;%0A%0Aimport org.finikes.sider.utils.CRC16;%0A%0A/**%0A * %0A * @author Finikes.Wu%0A *%0A */%0Apublic class RedisClusterSlotQuerier %7B%0A%09static CRC16 crc16 = CRC16.getInstance();%0A%0A%09public static int keyHashSlot(String key) %7B%0A%09%09String pk = getPureKey(key);%0A%09%09if (%22%22.equals(pk)) %7B%0A%09%09%09pk = key;%0A%09%09%7D%0A%0A%09%09return crc16.getCrc(pk.getBytes()) & 0x3FFF;%0A%09%7D%0A%0A%09private static String getPureKey(String origKey) %7B%0A%09%09int i0 = origKey.indexOf(%22%7D%22);%0A%09%09if (-1 == i0) %7B%0A%09%09%09return origKey;%0A%09%09%7D%0A%09%09int i1 = origKey.indexOf(%22%7B%22);%0A%09%09if (-1 == i1) %7B%0A%09%09%09return origKey;%0A%09%09%7D%0A%0A%09%09return origKey.substring(i1 + 1, i0);%0A%09%7D%0A%7D%0A

Create RedisClusterSlotQuerier.java