From 81afdf0703687f22e5c685441ad441c57cd2febd Mon Sep 17 00:00:00 2001 From: Muhsin Date: Tue, 17 Feb 2026 17:13:06 +0530 Subject: [PATCH] chore: add ttl helper to Redis::Alfred --- lib/redis/alfred.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/redis/alfred.rb b/lib/redis/alfred.rb index e7e04ed60..4e391487a 100644 --- a/lib/redis/alfred.rb +++ b/lib/redis/alfred.rb @@ -40,6 +40,11 @@ module Redis::Alfred $alfred.with { |conn| conn.expire(key, seconds) } end + # get time to live for a key in seconds + def ttl(key) + $alfred.with { |conn| conn.ttl(key) } + end + # scan keys matching a pattern def scan_each(match: nil, count: 100, &) $alfred.with do |conn|