昨天遇到redis一个奇怪问题,已超时的key居然还可以get到,导致程序逻辑错误,发现官方有人遇到和我一样的问题,最终确定是因系统设置了redis的maser和slave,当在slave上进行写入时就会遇到这样的问题。
ask:
Steps to reproduce:
- set a key with an expiry
- after expiry, issue GET for the key
$ redis-cli --version
redis-cli 2.4.17
$ redis-cli
redis 127.0.0.1:6379> setex testkey 1 testvalue
OK
redis 127.0.0.1:6379> ttl testkey
(integer) -1
redis 127.0.0.1:6379> keys *
(empty list or set)
redis 127.0.0.1:6379> get testkey
"testvalue"
redis 127.0.0.1:6379> exists testkey
(integer) 1
replay:
Please can you use INFO to check what version is your Redis server? What you are experiencing is very strange and is well covered by the test, is the test passing? Thanks.
ask:
$ redis-cli info
redis_version:2.4.17
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
gcc_version:4.6.1
process_id:1256
run_id:11cadfc4bd438f6d78ea90d04b95b5ccce2eace0
uptime_in_seconds:397475
uptime_in_days:4
lru_clock:823998
used_cpu_sys:89.27
used_cpu_user:56.49
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
connected_clients:1
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:721264
used_memory_human:704.36K
used_memory_rss:1949696
used_memory_peak:721480
used_memory_peak_human:704.57K
mem_fragmentation_ratio:2.70
mem_allocator:jemalloc-3.0.0
loading:0
aof_enabled:0
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1350369929
bgrewriteaof_in_progress:0
total_connections_received:7
total_commands_processed:163
expired_keys:0
evicted_keys:0
keyspace_hits:96
keyspace_misses:6
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:250
vm_enabled:0
role:slave
master_host:localhost
master_port:6380
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:0
master_link_down_since_seconds:397475
slave_priority:100
db0:keys=3,expires=3
replay:
Oh, ok, issue fixed, this is a slave not a master! :-)
You can write on a slave if it is not marked as read-only, but expires will never be expired as they can be expired only by master.
Closing the issue, thanks for reporting.
原文地址:https://github.com/antirez/redis/issues/712
转载于:https://my.oschina.net/u/569275/blog/100380
分享到:
相关推荐
解决方法是,在代码中添加以下认证,同时解决 Redis 中 Key 不存在的问题。程序发布成功后,需要将 Keystore 和 Truststore 文件放在 Test 目录中,配置为相对路径。密钥文件需要放在特定目录中,配置为绝对路径。 ...
标题“'flash builder beta2 licensing for this product has expired'”涉及到的是Adobe Flash Builder软件的授权问题。Flash Builder是一款由Adobe公司开发的专业Flex和ActionScript集成开发环境(IDE),主要用于...
MyEclipse 8.5 注册--取消MyEclipse Trial Expired解决办法
### ireasoning mib browser License Expired 解决办法 #### ireasoning mib browser简介 ireasoning mib browser是一款非常实用的MIB(Management Information Base)浏览器工具,广泛应用于网络管理和监控领域。...
String key = cacheEvictedEvent.getKey().toString(); System.out.println("Key " + key + " has expired. Handling business logic..."); // 在这里添加过期Key对应的业务处理代码 } } } ``` 在上述代码中,...
在Oracle数据库管理中,"ORA-28001 the password has expired" 是一个常见的错误,它表明数据库用户的密码已经超过了预设的有效期限,导致用户无法正常登录。这个错误主要出现在Oracle 11G及更高版本中,因为这些...
解决flash builder beta2 licensing for this product has expired(此产品的许可证已过期); 解压后存入Flex的安装文件夹plugins\com.adobe.flexide.amt_4.0.0.235740\os\win32\x86 替换源文件即可
解决mac上toad过期无法使用问题
tools for license windows expired
- **订阅方式**:通过订阅特定的通道(如`__keyspace@0__:*`来监听所有数据库的键变化,或`__keyevent@0__:expired`来监听键过期事件)。 - **应用示例**:可用于实时监控、日志记录、缓存更新、数据同步等。 3. ...
亲测可用, NoSQL Manager for MongoDB 2.7.x, 支持MongoDB 3.0, 下载运行 破解.bat即可
3. `getset(key, value)`:设置键的值并返回旧值。 4. `mget(key1, key2,..., key N)`:获取多个键的值。 5. `setnx(key, value)`:如果键不存在,设置键值对。 6. `setex(key, time, value)`:设置键值对并指定过期...
Microsoft Remote Desktop is designed to help you get your work done wherever you are. You can connect to remote PCs or applications and be productive as if these resources were running locally. ...
Telerik Collection for .NET 2018 R2 SP1 telerik.ui.for.aspnetmvc.2018.2.620.commercial.msi
"exp"通常代表"expired",意味着过了有效期或者试用期结束。这可能意味着用户需要更新或者重新激活软件才能继续使用。 【压缩包内的文件】: - `GTWR.chm`:这是一个帮助文件,通常包含有关GTWR软件的详细说明、...
VS2022安装VisualSVN后打开安装目录,替换VisualSVN.Core.L.dll文件 我电脑上安装目录是这个,其他人按照自己的安装情况找安装目录。 ... 下载文件包里有插件,也可以直接从扩展库联网下载最新版,然后只替换VisualSVN....
完美解决MyEclipse提示过期Your 30-day trial of MyEclipse has expired.
如果数据包在传递过程中未能在规定的跳数内到达目的地,它就会被丢弃,这种情况下在使用ping命令测试网络连通性时,会收到“TTL expired in transit”错误提示。这个错误通常意味着数据包在网络中形成了环路,或者源...
- **文件操作**:可能需要处理本地文件,如日志记录或下载过期域名列表,因此要熟悉file_get_contents、file_put_contents等函数。 - **安全**:防止SQL注入,使用预处理语句或参数绑定;对用户输入进行验证和过滤...
Microsoft 为 Mac 提供了测试版远程客户端,您可转到 Microsoft Remote Desktop for Mac 进行下载。该测试版本客户端由微软官方维护,我们推荐您优先使用该版本客户端(微软已于 2017 年取消其官网提供的下载链接,...