redis报错WRONGTYPE Operation against a key holding the wrong kind of value

这篇具有很好参考价值的文章主要介绍了redis报错WRONGTYPE Operation against a key holding the wrong kind of value。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

在redis中我们一般存储string、list、hash类型的值,对应的方法分别为 db.StringGet(“key”)、db.ListRange、db.HashGetAll 如果取list类型值时使用了string的方法就会报WRONGTYPE Operation against a key holding the wrong kind of value错误。

redis报错WRONGTYPE Operation against a key holding the wrong kind of value,Redis,redis,redis读string,redis读list、hash

redis报错WRONGTYPE Operation against a key holding the wrong kind of value,Redis,redis,redis读string,redis读list、hash

redis-cli命令窗口

#读取string类型的值
get "qwer"
#读取list hash表中data的值
hget "c:System.String,k:InternalMenuJson" data
#读取list hash表中所有的值
hgetall "c:System.String,k:InternalMenuJson"

C#实现文章来源地址https://www.toymoban.com/news/detail-680468.html

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Caching.Distributed;
using System;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using StackExchange.Redis;
using Newtonsoft.Json; 

namespace Test.Attribute
{
    public class AuthCustoms : AuthorizeAttribute, IAsyncAuthorizationFilter
    { 

        public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
        {
            var redis = ConnectionMultiplexer.Connect("123.33.44.123:6379,password=123asd,ConnectTimeout=15000,SyncTimeout=5000");
            var db = redis.GetDatabase();
            string value = db.StringGet("qwe");
            HashEntry[] aaaaaaaa= db.HashGetAll("c:System.String,k:InternalMenuJson");
            //RedisValue jsonValue = db.StringGet("62725");
            RedisValue bbbbb= db.HashGet("c:System.String,k:InternalMenuJson","data");
        }
    }
}

到了这里,关于redis报错WRONGTYPE Operation against a key holding the wrong kind of value的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 阿里云MQ报错:The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=403

    阿里云MQ报错:The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=403

    报错截图: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=403, text=\\\'AccessDeniedByRamPolicy, ReqId:639816A74146313600B7647E\\\', classId=10, methodId=40 处理方法:  AMQP协议返回码:   打开RAM控制台。选择“用户”,单击对应的用户名,在“权限管理”添加“AliyunAMQPFullA

    2024年02月16日
    浏览(15)
  • 报错解决 one of the variables needed for gradient computation has been modified by an inplace operation

    报错解决 one of the variables needed for gradient computation has been modified by an inplace operation

     one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [16, 64, 256, 256]], which is output 0 of LeakyReluBackward1, is at version 1;  最近跑代码遇到了这样的一个问题,在网上找了很多方法都没有很好的解决,今天就在这个博客里面将所有的解决办法整

    2024年02月16日
    浏览(11)
  • Flink 并发或短时间频繁修改 Doris 同一张表, 报错: There is an update operation in progress for the current table.

    Flink 并发或短时间频繁修改 Doris 同一张表, 报错: There is an update operation in progress for the current table.

    2022/12/06 菜鸟记录. 场景1 : Flink任务1: 监听Kafka TopicA 修改表1某条数据的a字段.             Flink任务2: 监听Kafka TopicB 修改表1某条数据的b字段.             当后端人员同时向TopicA和TopicB发送数据, 两个任务对 Doris 的 update 并发执行, 发生报错. 场景2 : Flink 自定义 Sink, 用

    2023年04月21日
    浏览(11)
  • MySQL报错:Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation

    今天在尝试删除已建的一个视图时,发现提示这个报错,多方查找解决办法后记录一下。 原因是MySQL8.0.16版本中新增了一个system_user帐户类型,我们需要把权限给添加进去,使用下方的代码,此处的root可以是你当前使用的账户 此时可解决,再尝试之前的操作发现就可以进行了

    2024年02月10日
    浏览(9)
  • Hadoop安装MySQL报错The GPG keys listed for the “MySQL 5.7 Community Server“ repository are already......

    Hadoop安装MySQL报错The GPG keys listed for the “MySQL 5.7 Community Server“ repository are already......

    目录 一、报错描述: 二、问题分析: 三、问题解决: 四、命令运行: 五、总结            没有配置正确的密钥URL,可能是由于密钥过期导致。在安装MySQL服务之前,先导入正确的密钥URL。记住是在安装之前导入!!!          下面命令2022表示年份。先导入正确的密

    2024年02月12日
    浏览(14)
  • 【Ubuntu升级报错】“the following signatures couldn’t be verified because the public key is not available”

    在ubuntu中运行apt-get update时,有时会出现如下报错 如果不去解决,无法继续进行后续的升级操作 这是由apt包系统的安全机制引起的问题,有时系统无法包含所有的key。此处有快速修复的办法,即将缺少的key加进去即可。 观察里面的报错,其实是4EB27DB2A3B88B8B( 请注意,每个人

    2024年02月12日
    浏览(9)
  • 报错:Another app is currently holding yum lock

    一、问题原因: 在运行yum 相关命令“yum remove”的时候,不知道怎么回事无法进行下载安装,报出 Another app is currently holding the yum lock; waiting for it to exit... 的错误提示。 二、环境: centos7 Linux 三、解决问题: 1、分析:报错显示/var/run/yum.pid 已被锁定,pid为3347。  Another app

    2024年02月15日
    浏览(7)
  • registryResult:ReturnT [code=500, msg=The access token is wrong., content=null]

    registryResult:ReturnT [code=500, msg=The access token is wrong., content=null]

    错误描述: 在项目集成xxl-job发现执行器一直注册不上去,心跳报错。 错误现象:   : xxl-job registry fail, registryParam:RegistryParam{registryGroup=\\\'EXECUTOR\\\', registryKey=\\\'lottery-job\\\', registryValue=\\\'http://192.168.3.102:9999/\\\'}, registryResult:ReturnT [code=500, msg=The access token is wrong., content=null] xxl-job项目中

    2024年02月11日
    浏览(7)
  • 500 Whoops, something went wrong on our end. Try refreshing the page

    gitlab在runner栏点击就报500 Whoops, something went wrong on our end. Try refreshing the page。原因是迁移gitlab迁移时备份恢复后报aes256_gcm_decrypt是因为敏感数据的加密密钥发生变化或密钥丢失了,重置密钥修复数据即可。 解决办法 首先 进入这个gitlab的容器 进入: kubectl exec -it gitlab的pod的名

    2024年02月06日
    浏览(9)
  • chatgpt报错 Something went wrong 解决方法

    chatgpt报错 Something went wrong 解决方法

    Something went wrong. If this issue persists please contact us through our help center at help.openai.com. 1.网络无问题,使用Windows桌面板 使用 ChatGPT/README-ZH_CN.md at main · lencx/ChatGPT (github.com) https://github.com/lencx/ChatGPT/blob/main/README-ZH_CN.md 2.切换上网节点 更换 上网工具    

    2024年02月13日
    浏览(13)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包