9951 explained code solutions for 126 technologies


lua-redisGet key TTL


local redis = (require 'redis').connect('127.0.0.1', 6379)
local expires_in = redis:ttl('key')ctrl + c
require 'redis'

load Redis module for Lua

connect

connect to Redis server

'127.0.0.1', 6379

Redis host and port to connect to

:ttl

returns seconds it'll take specified key to expire (or -1 if it's not expirable)

'key'

name of the key to get expiration second for