I am working an a Hashing based program . My question is will the HashCode of a String will remain the same for the entire application .
The reason i was asking this because , the KetamaMemcachedSessionLocator inside Mecached Servers works this way If there are two servers on which Memcache is running , i want to locate a key from a Particular server .
String key = "MyString"; int keyid = key.hashCode(); int v = keyid % 1; //( I assume that this will contact the First Server to retrieve that value ) int v = keyid % 2; //( I assume that this will contact the Second Server to retrieve that value ) String value = MemcachedClient.get(key, v); Followed to implement the above based on this website
http://dev.mysql.com/doc/refman/5.0/en/ha-memcached-using-hashtypes.html
please share your views , incase if you find any issues if the above way it works .
![h(s)=\sum_{i=0}^{n-1}s[i] \cdot 31^{n-1-i}](https://i.sstatic.net/i93PQ.png)