UNPKG

ioredis-mock

Version:

This library emulates ioredis by performing all operations in-memory.

17 lines (14 loc) 286 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ttl = ttl; function ttl(key) { if (!this.data.has(key)) { return -2; } if (!this.expires.has(key)) { return -1; } return Math.ceil((this.expires.get(key) - Date.now()) / 1000); }