Skip to content

Commit e62202d

Browse files
committed
feat: add expiretime command
1 parent 73ca47e commit e62202d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/commands/expiretime.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export function expiretime(key) {
2+
if (!this.data.has(key)) {
3+
return -2
4+
}
5+
6+
if (!this.expires.has(key)) {
7+
return -1
8+
}
9+
10+
return Math.round(this.expires.get(key) / 1000)
11+
}
12+
13+
export const expiretimeBuffer = expiretime

src/commands/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export * from './evalsha'
2020
export * from './exists'
2121
export * from './expire'
2222
export * from './expireat'
23+
export * from './expiretime'
2324
export * from './failover'
2425
export * from './flushall'
2526
export * from './flushdb'

0 commit comments

Comments
 (0)