首页 > 数据库 >Redis Commands - GETRANGE SETRANGE

Redis Commands - GETRANGE SETRANGE

时间:2024-01-14 17:14:32浏览次数:20  
标签:Commands GETRANGE 0.1 Redis 6379 127.0 model x00 SETRANGE

 

 

Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit.

 

127.0.0.1:6379> SET model toyota
OK
127.0.0.1:6379> GET model
"toyota"
127.0.0.1:6379> GETRANGE model 0 2
"toy"
127.0.0.1:6379> SETRANGE model 0 2 l
(error) ERR wrong number of arguments for 'setrange' command
127.0.0.1:6379> SETRANGE model 3 seller
(integer) 9
127.0.0.1:6379> GET model
"toyseller"
127.0.0.1:6379> SETRANGE model 10 one
(integer) 13
127.0.0.1:6379> GET model
"toyseller\x00one"
127.0.0.1:6379> SETRANGE db 6 Redis
(integer) 11
127.0.0.1:6379> GET db
"\x00\x00\x00\x00\x00\x00Redis"

 

标签:Commands,GETRANGE,0.1,Redis,6379,127.0,model,x00,SETRANGE
From: https://www.cnblogs.com/zhangzhihui/p/17963903

相关文章

  • Redis - Use case of expiration options
        Automaticallydeletingthecachedkey: ......
  • redis工具类封装
    封装Redis工具类方法1:将任意Java对象序列化为json并存储在string类型的key中,并且可以设置TTL过期时间方法2:将任意Java对象序列化为json并存储在string类型的key中,并且可以设置逻辑过期时间,用于处理缓存击穿问题方法3:根据指定的key查询缓存,并反序列化为指定类型,利用缓存空......
  • Redis - Why use Redis?
    RedisisfastWhyisRedisfast?AlldataisstoredinmemoryDataisorganizedinsimpledatastructuresRedishasasimplefeatureset       ......
  • redis 数据库
    1redis单机数据库结构1redisserver/client结构 2 每个数据库都有一个包含所有数据的字典 2过期时间redis每个库都会保存一个结构,里面包含了每个键的过期时间的字典结构;redis 如何判断过期,首先检查给的键是否在过期字典中,如果在,那就获取过期时间,在检查当前Un......
  • 分布式限流——基于Redis的Lua脚本限流实现
    分布式限流当你的应用分布式部署出现对等端(peer)时,单机的限流往往不能满足对下游保护的作用,因为它仅仅是jvm内存层面的流量控制。这个时候自然而然会想到用一些跨JVM的分布式中间件控制在单位时间窗口内的请求是否通行,本文我们将探讨如何借助Redis实现分布式限流。1固定窗口限流......
  • delphi redisclient测试
    unitUnit1;interfaceusesWinapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System.Classes,Vcl.Graphics,Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.Buttons;typeTForm1=class(TForm)Memo1:TMemo;BitBtn1:......
  • Redis 哨兵启动 以及 手动切换节点
      服务启动  ./redis-server ../redis.conf   哨兵启动./redis-sentinel../sentinel.conf查看当前服务是否是主节点(先登录到redis)INFOreplication 要将从节点切换为主节点,您可以执行以下步骤:首先,确保从节点已成功连接到主节点。您可以使用 INFOrep......
  • Linux 部署redis集群(三主三从)
    1、由于redis是C语言编写的,安装之前需要保证有gcc的环境配置首先使用命令,查看gcc版本,若已经存在则跳过gcc的安装:gcc-v若不存在gcc,则使用命令安装gcc:yuminstallgcc-c++2、下载redis源文件mkdir/usr/local/rediscd/usr/local/rediswgethttp://download.redis.io/relea......
  • redis 浅谈3
    1redis数据结构简介sds链表字典跳跃表整数集合 压缩列表 2过期时间redis每个库都会保存一个结构,里面包含了每个键的过期时间的字典结构;redis 如何判断过期,首先检查给的键是否在过期字典中,如果在,那就获取过期时间,在检查当前Unix时间戳是否大于键的过期时间 3......
  • Redis持久化之RDB和AOF
    Redis是基于内存的,内存中的信息断电丢失,有时需要持久化来解决这个弊端。在之前的文章中Shiro中使用Redis管理session-东方来客-博客园(cnblogs.com)使用了Redis管理Shiro的session。想要配置Redis持久化不是在Maven项目中,而是要通过redis.conf配置来影响Redis,这里通过Doc......