In fact, it is almost impossible to meet a conflict. I think it is safe
enough.  see this link for more info: http://en.wikipedia.org/wiki/SHA-1

2015-01-07 14:11 GMT+08:00 sekhar mekala <[email protected]>:

> HI Ryan,
>
> Thanks for your valuable suggestion. But using md5 or sha1 to Hash your
> string, This key is collision or not.
>
> Please help me.
>
> Thanks
> Sekhar
>
> On Tuesday, December 30, 2014 10:52:24 PM UTC+5:30, Ryan McElroy wrote:
>>
>> You can't; its a on-purpose limitation of memcached. What you can do is
>> use md5 or sha1 to hash your string and use that as a key.
>>
>> Long keys are usually a sign of misuse of memcached, though, so it often
>> helps to take a step back and evaluate what you actually need to put into
>> your key.
>>
>> ~Ryan (mobile)
>>
>> On Dec 30, 2014, at 6:33 AM, sekhar mekala <[email protected]> wrote:
>>
>> HI Team,
>>
>>
>>  I need to store the key size more than 250 characters in memcached
>> server.
>>
>> I am tried with my code:
>>
>> *code:*
>>  MemcachedClient client = new MemcachedClient((new
>> InetSocketAddress("192.168.7.134", 11211)));
>>  String key="292FEC76-5F1C-486F-85A5-09D88096F098_
>> VirtualizationObjectNamesInfo_CustomerManagementObject#
>> 292FEC76-5F1C-486F-85A5-09D88096F098#"+ "(TENANT_PARENTOBJECTID='
>> FFCEF160-BAEE-4876-9C45-8D179DC90481'$OR$TENANT_
>> PARENTOBJECTID='B813170B-3390-4B51-9E6C-81EF3D44BB94'$"+
>> "OR$TENANT_PARENTOBJECTID='CD8C669F-A8AA-4987-9B71-
>> ABFBF5207014'$OR$TENANT_PARENTOBJECTID='373F4223-BD1E-4B4C-AE86-F0B09F3D7FBE'$"+
>> "OR$TENANT_PARENTOBJECTID='1DE854CA-2E51-4B6B-A3F2-
>> 2EC1A9626D1D'$OR$TENANT_PARENTOBJECTID='32C4B07F-804B-45E1-A594-03472945FC1E'$OR"+
>> "$TENANT_PARENTOBJECTID='608E4495-8FF9-49DB-8476-CAFCFF84A5B1'$OR"+
>> "$TENANT_PARENTOBJECTID='ACFEB0D5-586E-45C1-A3B4-24781C1D07A5')#(TENANT_
>> CHILDOBJECTID='FFCEF160-BAEE-4876-9C45-8D179DC90481'$OR"+
>> "$TENANT_CHILDOBJECTID='B813170B-3390-4B51-9E6C-81EF3D44BB94'$OR$TENANT_
>> CHILDOBJECTID='CD8C669F-A8AA-4987-9B71-ABFBF5207014'$OR"+
>> "$TENANT_CHILDOBJECTID='373F4223-BD1E-4B4C-AE86-F0B09F3D7FBE'$OR$TENANT_
>> CHILDOBJECTID='1DE854CA-2E51-4B6B-A3F2-2EC1A9626D1D'$OR"+
>> "$TENANT_CHILDOBJECTID='32C4B07F-804B-45E1-A594-03472945FC1E'$OR$TENANT_
>> CHILDOBJECTID='608E4495-8FF9-49DB-8476-CAFCFF84A5B1'$OR"+
>> "$TENANT_CHILDOBJECTID='ACFEB0D5-586E-45C1-A3B4-
>> 24781C1D07A5')#978754F1-AE6D-4201-85B3-0008BD3EE190_v1.0";
>>
>> System.out.println("Key size:" + key.length());
>> client.set(key, 3600, "teststse");
>> System.out.println(client.get(key));
>>
>> *Error:*
>> 2014-12-30 19:20:57.944 INFO net.spy.memcached.MemcachedConnection:
>>  Added {QA sa=/192.168.7.134:11211, #Rops=0, #Wops=0, #iq=0,
>> topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
>> Key size:1184
>> 2014-12-30 19:20:57.947 INFO net.spy.memcached.MemcachedConnection:
>>  Connection state changed for sun.nio.ch.SelectionKeyImpl@6c6455ae
>> Exception in thread "main" java.lang.IllegalArgumentException: Key is
>> too long (maxlen = 250)
>> at net.spy.memcached.util.StringUtils.validateKey(StringUtils.java:69)
>> at net.spy.memcached.MemcachedConnection.enqueueOperation(
>> MemcachedConnection.java:745)
>> at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:310)
>> at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:844)
>> at MemcachedConnectionPooling.ClearedMemcachedServer.main(
>> ClearedMemcachedServer.java:42)
>>
>>
>>
>> Client: spymemcached
>> Server: memcached
>>
>> plz help me.
>> Thanks in advace
>>
>> Sekhar.
>>
>>
>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "memcached" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to