Wrongtype operation against a key holding the wrong kind of value: type mixed up error

Source: Internet
Author: User



Today, using C # to connect Redis for performance testing, with the interface is Stackexchange.redis, according to the normal idea of getting the database connection, the code is as follows:


1 string conn = "my ip: 6379, password = login password";
2 
3 ConnectionMultiplexer client = ConnectionMultiplexer.Connect (conn);
4
5 IDatabase db = client.GetDatabase (2); 





Then add the data to the inside, similar to the following code:


 
 
1                 RedisKey key ="1";
2 
3                 RedisValue value = "....";
4 
5                 this.db.SetAdd(key, value);


After you finish, use REDIS-CLI to connect to Redis with the following command:


192.168. 1 6379 -a login password


After successful login to get the way to obtain such as: Get 1, found an error:Wrongtype operation against a key holding the wrong kind of value, to the Internet to see there is said to repeat the value of what is said, after To check the code to see that I was adding data using this.db.SetAdd (key, value); The meaning of this sentence is to add code to the collection and later modify it to This.db.StringSet (key, value); Everything's fine.






Originally is a very basic problem check AH check, also thought is the key value or value values appear special characters caused by, check for half a day, if later brothers encounter like me the same problem may go to see your type is not a problem, to the time when using get error, with Smembers 1 We can all come out. It's a collection, the Novice brothers learn together, the old birds don't bother me, this is not for the veteran to see



Wrongtype operation against a key holding the wrong kind of value: type mixed up error


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.