python - 使用 Python 增加 Redis 中哈希字段的值
问题描述
我hash
在python中创建了一个redis,如下所示:
r.hmset('list:123', {'name': 'john', 'count': 5})
如何增加键的计数值list:123
?
解决方案
hash = 'list:123'
key = 'count'
n = 1
r.hincrby(hash, key, n)
推荐阅读
- gcloud - Gcloud kms 错误:crypto_key_version.state:DESTROYED,但 ENABLED 是必需的
- python - 如何改进我的循环 Python 脚本,在每个循环中针对不同条件涉及不同的数学运算?
- azure - Dotnet Core:如何从外部库获取配置
- python - Python 中的行数
- android - 如何从xml中删除节点?
- javascript - Number()、parseInt()、String() 等 Javascript 函数在哪里定义?
- xamarin - 如何在skiasharp xamarin表单中调用PaintSurface两次
- c# - 仅在文本框上的路径
- python - 从文件中简单解析和排序数据
- firebase - 从 Fire 基础服务器时间戳获取日期并将其显示在 ionic 3 应用程序上