{"id":4579,"date":"2019-12-05T19:04:16","date_gmt":"2019-12-05T11:04:16","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=4579"},"modified":"2019-12-05T19:04:16","modified_gmt":"2019-12-05T11:04:16","slug":"wrongtype-operation-against-a-key-holding-the-wrong-kind-of-valuewrongtype-operation-against-a-key-holding-the-wrong-kind-of-value","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=4579","title":{"rendered":"WRONGTYPE Operation against a key holding the wrong kind of valueWRONGTYPE Operation against a key holding the wrong kind of value"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u89e3\u51b3 Redis redisTemplate.opsForHash().entries \u62a5  WRONGTYPE Operation against a key holding the wrong kind of valueWRONGTYPE Operation against a key holding the wrong kind of value \u95ee\u9898!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u5728\u7f51\u4e0a\u770b\u5230\u4e0d\u5c11\u7f51\u53cb\u9047\u5230\u8fd9\u4e2a\u95ee\u9898\uff0c\u5305\u62ec\u6211\u7684\u540c\u4e8b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u95ee\u9898\u5176\u5b9e\u5e76\u4e0d\u590d\u6742\uff0c\u4e5f\u5e76\u4e0d\u96be\u3002\u4ea7\u751f\u7684\u539f\u56e0\u662f\uff0cRedis \u7684\u8fd9\u4e2a key\uff0c\u5b58\u50a8\u7684\u4e0d\u662f\u4e00\u4e2a hash\uff0c\u800c\u6211\u4eec\u5374\u6309\u7167 Hash \u7684\u65b9\u5f0f\u53bb\u53d6\u8fd9\u4e2a key\uff0c\u5c31\u4f1a\u62a5\u8fd9\u4e2a\u5f02\u5e38\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9047\u5230\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u5148\u901a\u8fc7 type key \u67e5\u770b\u4e00\u4e0b\u8fd9\u4e2a key \u5b58\u50a8\u7684\u5230\u5e95\u662f\u4ec0\u4e48\u7c7b\u578b\u7684\u6570\u636e\u3002\u5982\u679c\u7c7b\u578b\u4e0d\u5bf9\uff0c\u53ef\u4ee5\u5148\u628a\u5b83\u5220\u9664\u6389\uff0c\u6216\u8005\u7528\u5176\u5b83\u65b9\u5f0f\u53d6\u8fd9\u4e2a key\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c key \u4e3a hash \u7c7b\u578b\uff0c\u6b64\u65f6\u64cd\u4f5c\u8fd9\u4e2a\u6570\u636e\u5c31\u5fc5\u987b\u4f7f\u7528 hset\u3001hget \u7b49\u64cd\u4f5c\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c key \u4e3a zset \u7c7b\u578b\uff0c\u5219\u8868\u793a\u4e3a Sorted Sets \u7c7b\u578b\u7684\u6570\u636e\uff0c\u6b64\u65f6\u64cd\u4f5c\u8fd9\u4e2a\u6570\u636e\u5c31\u5fc5\u987b\u4f7f\u7528 zadd\u3001zrange \u7b49\u64cd\u4f5c\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9664\u6b64\u4e4b\u5916\uff0c\u8981\u6ce8\u610f\u4f60\u7684 RedisTemplate \u662f\u5426\u672a\u6ce8\u5165\uff0c\u5982\u679c\u662f\u7a7a\u7684\u8bdd\uff0c\u5728\u67d0\u4e9b\u4ee3\u7406\u6a21\u5f0f\u4e0b\uff0c\u62a5\u7684\u5f02\u5e38\u53ef\u80fd\u4e5f\u662f WRONGTYPE Operation against a key holding the wrong kind of value\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\uff0c\u5c31\u662f Redis \u4e2d\u4e0d\u540c\u6570\u636e\u7c7b\u578b\u7684 key\uff0c\u522b\u91cd\u590d\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\uff0c\u5982\u679c\u8fd8\u6ca1\u6709\u89e3\u51b3\u4f60\u7684\u95ee\u9898\uff0c\u8bf7\u52a0\u6211\u7684\u5fae\u4fe1\u53f7\u6559\u4f60\u89e3\u51b3\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=4579\">WRONGTYPE Operation against a key holding the wrong kind of valueWRONGTYPE Operation against a key holding the wrong kind of value<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u89e3\u51b3 Redis redisTemplate.opsForHash().entries \u62a5 WRONGTYPE [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[669,672,1876,1877,2038],"class_list":["post-4579","post","type-post","status-publish","format-standard","hentry","category-java","tag-redis","tag-redis-cluster","tag-redis-hgetall-","tag-redis-hgetall","tag-redistemplate"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4579"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4579\/revisions"}],"predecessor-version":[{"id":4580,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4579\/revisions\/4580"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}